Jump to content
Joe Lusk

Working with a CSV variable

Recommended Posts

Posted (edited)

I have a unique situation where I an trying to modify a list to enable it to more easily work in a powershell script.  The text looks like this:

SprocketUsers,Domain Users,Password Sync

It can vary in length so I am doing a ForEach type function with it in PS

Now to use it in my PS script each CSV needs to have a single quote on it, like this:

'SprocketUsers','Domain Users','Password Sync'

I can do a REGEX and split them out, but it appears that I can only work with the first match(?)  SET: @Output1@  =  MATCH(@sqldefaultgroups@ PATTERN (?<=^|,)(?:'{2}|(?:)|[^,'\r\n]+|'(?:'{2}|[^']+)+')(?=,|$))

Does anyone know any way to do this reformatting? Either via Automate scripting or PS


Edited by Joe Lusk

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now