shwango! blog
life, love and some other stuff…

Cool regex stuff…

I was playing around with some regex (regular expression) stuff today and learned about “lookahead” and “lookbehind”.

This expression (?<=\{\{).+(?=\}\}) will return all the characters, numbers and spaces between two curly brackets, but not the brackets themselves.

For example, the string This is {{a test}} of regex returns just a test when the regex is applied.

I also found the Regex Coach which was a great help in debugging the regular expressions.

Comments

  1. jen
    July 5th, 2005 | 4:47 pm

    You are a big TOOL