One other thing...escaping things in regexes makes them very hard to read. One trick is to put the character inside a character class. Inside a character class, the special regex characters lose their special meaning. Also, using some whitespace to separate the parts of your regex (coupled with the x modifier) will make your regexes easier to read: