I don’t know about you but I’m constantly tripped up when I need to write regular expressions. More often than not I ends up with many stabs in the dark until I hit Regex gold. Part of the problem is often you can’t really get a visual grasp on what your expression is picking up and ignoring. Luckily there’s this gem. It’ll let you build a regular expression and see its actions on the sample text you provide. I still end up flailing away but at least with this it’s not quite so dark.
Visual Regex builder: http://gskinner.com/RegExr/
(Remember different regular expression implementations will have their own syntax and quirks so you might need to do a little translation to get it working in your language)