If you learn regular expression things then it will be easy for you here after.
http://www.regular-expressions.info/[
^] - Which contains tutorials, tools, examples, books & references.
http://www.regxlib.com/[
^] - Massive library contains many examples
Now pick the regex which you want in these sites.