This is quick, but important for anyone who has to deal with regular expressions occasionally.

Sometimes I see regular expression search-and-replace lines that look like this, often from developers I consider far more advanced than me.


Remember: in nearly all regex implementations, you can swap out the slash for any one-character keyword.  If you’re working with URLs and file paths, this is a must if you want to avoid too much slash escaping.

Compare this to the previous expression:


Much more readable!  Whichever character you choose (I like # because I rarely use it, but : is an easy-to-type option), just place it right after the ‘s’.  Use the same character between the expression search and result, and at the end if you’re adding optional flags.  This works in most programming & scripting languages, and tools like sed.