You got good advice and replies..
only my little tip; as you are playing with regular expressions you definitively need some playfield: see
this post to have 3 useful tools at your disposal.
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.