Thread:Knj00/@comment-4830404-20121014224528/@comment-4830404-20121015191230

Well, a regular expression is like a more powerful version of Find and Replace. You can search for patterns (not just specific strings), and even capture some parts of the pattern in the Find step for use in the Replace step. They are very cool.

So here's an example:

You have a list that looks like this:

Aether Dragon (Blue, Purple) Island Dragon (Green, Blue) Quetzal Dragon (Green, Diamond) Scorpion Dragon (Red, Yellow)

Say that instead of the comma you want it to be replaced with ampersand & in between them. You can do that in a single line with a regular expression. Depending on what language or text editor supporting regexps that you're working in, the syntax is slightly different, but if you're working in Vim for example, you could do this:


 * %s/(\(\w\+\), \(\w\+\))/(\1 \& \2)/g

That would transform the list into this:

Aether Dragon (Blue & Purple) Island Dragon (Green & Blue) Quetzal Dragon (Green & Diamond) Scorpion Dragon (Red & Yellow)