Regular Expressions, by themselves, don't solve your problem. Regular expressions, implemented as part of a tool like sed or grep, or as part of a programming language like Perl or Java, can.
Regular expressions are basically just a (powerful) way to match patterns in text. If you've done "ls *.sh" in a directory to list only the .sh files, you've used something very much like a regular expression. But that's just working on filenames, tools like grep and sed can look inside a file and match patterns, and sed can then replace those patterns with whatever you supply.
If you just want to start off learning regexes, google "regex tutorial" and start playing around searching through files with grep or something.
For your specific case, you should be able to do what you want to do with sed[1], or with awk[2]. Or if you're more comfortable with a higher level language, you could go with anything that has regex support, which should be most mainstream languages.
[1]: http://en.wikipedia.org/wiki/Sed
[2]: http://en.wikipedia.org/wiki/AWK
Regular expressions are basically just a (powerful) way to match patterns in text. If you've done "ls *.sh" in a directory to list only the .sh files, you've used something very much like a regular expression. But that's just working on filenames, tools like grep and sed can look inside a file and match patterns, and sed can then replace those patterns with whatever you supply.
If you just want to start off learning regexes, google "regex tutorial" and start playing around searching through files with grep or something.
For your specific case, you should be able to do what you want to do with sed[1], or with awk[2]. Or if you're more comfortable with a higher level language, you could go with anything that has regex support, which should be most mainstream languages.
[1]: http://en.wikipedia.org/wiki/Sed
[2]: http://en.wikipedia.org/wiki/AWK