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.

Expression:   (.+)
Replace with: '\$1'

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!

Expression:   [\n\r]
Replace with: ,

Oh so handy, hope it saves you some time!

EDIT:

Adding another, removing blank lines in a script

^(?:[\t ]*(?:\r?\n|\r))+

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