Have you ever found yourself needing to edit a long list with usernames, and you had to go in and manually clean that list up, format it properly, wrap it in quotes and so forth? Yeah, it’s painful, but I finally found this handy regex statement that makes it all better.

So let’s take we have a regular user list

After running the regex, we have them all neatly wrapped in quotes

Now we have this nice list, but let’s say we need that as a string in a line. regex? Yeah no problem!

Oh so handy, hope it saves you some time!


Adding another, removing blank lines in a script

Replace this with nothing to remove all empty lines. :¬)