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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...