Check out CPAN for the Perl module called Regex::Common. It has pre-built regexes for many common things so that you don’t have to bang your head against the wall.
http://search.cpan.org/dist/Regexp-Common/
e.g: # we require that $replacement be JUST a valid IP address
die “Invalid IP address provided: [$replacement]”
unless $replacement =~ m/^$RE{net}{IPv4}$/;
Jan 29, 2007, 11:49AM PST | 0 comments
http://www.wilsonmar.com/1regex.htm
There are a lot of good examples, like matching IP addresses and MAC addresses.
Jul 18, 2006, 02:00PM PDT | 0 comments
I found a website listing a large number of common regex patterns:
regexlib
May 13, 2006, 08:27PM PDT | 0 comments
First, I read this guide.
Next, here’s an example to puzzle over:
sentence.gsub( /\([-\w]+\)/, ’’ )
This example will find the literal parens characters with one or more words in between and replace them with nothing.
May 13, 2006, 02:56PM PDT | 0 comments