perl common regexpsNote: these tend to be "good enough", not necessarily "pedantically correct". IPv4 address (decimal)
m#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#
MAC address
m#\d{2}:\d{2}:\d{2}:\d{2}:\d{2}:\d{2}#
m#\d{4}\.\d{4}\.\d{4}#
URL and description (overly simple)
m#(.*)#i # returns URL in $1, text in $2
extract URLs (via qxurl by tchrist from perlfaq9)
# returns URL in $2, text in $3
m#<\s*a\s*href\s*=\s*(["'])(.*?)\1\s*>(.*)#gsix
#!/usr/bin/perl -n00
# qxurl - tchrist@perl.com
print "$2\n" while m{
< \s*
A \s+ HREF \s* = \s* (["']) (.*?) \1
\s* >
}gsix;
date: 12/17/2009 |
|