in reply to search and replace using regular expression

Others have already given answers to your original question. If you want to venture further, there are lots of Regexp modules.
--Artist