Programming Wiki: [[Regex #regex]] FAQ list

Programming Wiki : RegexFAQ

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2008-07-23 16:09:41 by MarkEdgar [add link to excellent HTML parsing article]

Additions:
Read How to parse HTML... and Bring Me Your Regexs! I Will Create HTML To Break Them!.

Deletions:
Read How to parse HTML....



Edited on 2007-10-14 14:56:45 by MarkEdgar [add description]

Additions:

#regex FAQ list

This is the FAQ list for #regex.


Deletions:

Regular Expression FAQ list





Edited on 2007-07-12 00:08:16 by ScottRippee

Additions:

Regular Expression FAQ list


How do I parse HTML/XML?
Read How to parse HTML....
Here is a short list of HTML parsers for popular languages. XML parsers seem to be easy enough to find.
For UNIX command line tools (awk, sed, etc), consider converting HTML to XHTML using Tidy and then to PYX using XMLStarlet.
 ## extract all hyperlinks
<bookmark.htm  tidy -asxhtml 2>/dev/null  | xmlstarlet pyx  | sed '/^(a/,/^)a/!d;/^Ahref /!d;s///' 

How do I match a URL?

How do I match text which doesn't match a pattern?
How do I negate a match?
Ideally, you'll want to use the features of your language or application software to do this. Here are some examples:
Perl:
$str !~ m/foo/

PHP:
if (!preg_match("/foo/", $string))

sed:
 /foo/d

vi:
 :v/foo/p

mod_rewrite:
!/foo/

grep:
 grep -v foo

If you cannot use such a technique because your application (e.g. a text editor) does not allow that level of programmability, you may be able to get by with an expression such as:
 /^(?!.*foo)/s
Note however that this may be much slower than the equivalent negated expression.

How do I match text which contains words in any order?
How do I match text which matches more than one pattern?
This is another of those situations where regular expressions alone are not enough. The best way is to match the line against multiple patterns:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s


Deletions:
cheap hgh tenuate online online zoloft free midi ringtones alprazolam online cheap ambien sony ericsson ringtones lisinopril online midi ringtones carisoprodol online nokia ringtones free funny ringtones didrex online buy hgh cheap didrex free sony ringtones order ultram hgh online ericsson ringtones online fioricet cialis online order flexeril carisoprodol online real ringtones hoodia online ambien cheap lipitor free online pharmacy free free ringtones zanaflex online cheap phentermine buy diethylpropion soma online free sprint ringtones diazepam online sharp ringtones hydrocodone online online adipex buy xanax cheap clomid free tracfone ringtones free sharp ringtones lisinopril wellbutrin online kyocera ringtones motorola ringtones cheap phentermine zoloft online carisoprodol online alprazolam online diethylpropion online nokia ringtones albuterol online free funny ringtones valium online buy tramadol online fioricet cheap viagra free samsung ringtones mtv ringtones cheap norco free music ringtones buy ativan tenuate online lipitor online free ericsson ringtones cheap soma cheap ambien rivotril online cialis tramadol online free ericsson ringtones free mtv ringtones cheap propecia jazz ringtones kyocera ringtones viagra online norco alltel ringtones zanaflex online motorola ringtones cheap viagra lortab online music ringtones free mp3 ringtones buy albuterol clonazepam online ambien online xenical online real ringtones cheap nexium wellbutrin online free sonyericsson ringtones celexa online diazepam online free nextel ringtones cheap soma mp3 ringtones hoodia online nextel ringtones cheap vicodin free sagem ringtones free punk ringtones cheap propecia free mono ringtones free polyphonic ringtones cheap levitra wwe ringtones lorazepam online free samsung ringtones zanaflex online online norco nexium online cheap ultram buy hoodia cheap hgh free cool ringtones mono ringtones cheap rivotril meridia online cheap cialis jazz ringtones clomid online cheap ortho ativan online cheap diazepam cingular ringtones valium online hydrocodone online ativan sagem ringtones cheap alprazolam rivotril online cingular ringtones valium online online tenuate lorazepam online mtv ringtones sonyericsson ringtones ultram online zyban online mp3 ringtones cheap sildenafil alltel ringtones free sagem ringtones zoloft online but clonazepam cheap lortab real ringtones buy cyclobenzaprine prozac online ultracet online albuterol vigrx online ortho online free ericsson ringtones cheap adipex motorola ringtones music ringtones free verizon ringtones vigrx online free wwe ringtones xenical online cheap paxil phentermine online free free ringtones soma online cheap diethylpropion punk ringtones meridia online free nokia ringtones free ringtones online alprazolam cheap sildenafil cheap fioricet order fioricet cheap meridia tracfone ringtones but hydrocodone sprint ringtones free sony ringtones sharp ringtones sonyericsson ringtones ortho online levitra cheap prozac zyban online sharp ringtones nokia ringtones mono ringtones buy rivotril free jazz ringtones lisinopril online norco online cheap ativan free kyocera ringtones levitra online cheap xanax cool ringtones cialis online levitra cheap tramadol cheap vicodin [[http://people.msoe.edu/~millerni/forums.php?show=topic



Edited on 2007-07-10 16:47:56 by QdkZ5j

Additions:
cheap hgh tenuate online online zoloft free midi ringtones alprazolam online cheap ambien sony ericsson ringtones lisinopril online midi ringtones carisoprodol online nokia ringtones free funny ringtones didrex online buy hgh cheap didrex free sony ringtones order ultram hgh online ericsson ringtones online fioricet cialis online order flexeril carisoprodol online real ringtones hoodia online ambien cheap lipitor free online pharmacy free free ringtones zanaflex online cheap phentermine buy diethylpropion soma online free sprint ringtones diazepam online sharp ringtones hydrocodone online online adipex buy xanax cheap clomid free tracfone ringtones free sharp ringtones lisinopril wellbutrin online kyocera ringtones motorola ringtones cheap phentermine zoloft online carisoprodol online alprazolam online diethylpropion online nokia ringtones albuterol online free funny ringtones valium online buy tramadol online fioricet cheap viagra free samsung ringtones mtv ringtones cheap norco free music ringtones buy ativan tenuate online lipitor online free ericsson ringtones cheap soma cheap ambien rivotril online cialis tramadol online free ericsson ringtones free mtv ringtones cheap propecia jazz ringtones kyocera ringtones viagra online norco alltel ringtones zanaflex online motorola ringtones cheap viagra lortab online music ringtones free mp3 ringtones buy albuterol clonazepam online ambien online xenical online real ringtones cheap nexium wellbutrin online free sonyericsson ringtones celexa online diazepam online free nextel ringtones cheap soma mp3 ringtones hoodia online nextel ringtones cheap vicodin free sagem ringtones free punk ringtones cheap propecia free mono ringtones free polyphonic ringtones cheap levitra wwe ringtones lorazepam online free samsung ringtones zanaflex online online norco nexium online cheap ultram buy hoodia cheap hgh free cool ringtones mono ringtones cheap rivotril meridia online cheap cialis jazz ringtones clomid online cheap ortho ativan online cheap diazepam cingular ringtones valium online hydrocodone online ativan sagem ringtones cheap alprazolam rivotril online cingular ringtones valium online online tenuate lorazepam online mtv ringtones sonyericsson ringtones ultram online zyban online mp3 ringtones cheap sildenafil alltel ringtones free sagem ringtones zoloft online but clonazepam cheap lortab real ringtones buy cyclobenzaprine prozac online ultracet online albuterol vigrx online ortho online free ericsson ringtones cheap adipex motorola ringtones music ringtones free verizon ringtones vigrx online free wwe ringtones xenical online cheap paxil phentermine online free free ringtones soma online cheap diethylpropion punk ringtones meridia online free nokia ringtones free ringtones online alprazolam cheap sildenafil cheap fioricet order fioricet cheap meridia tracfone ringtones but hydrocodone sprint ringtones free sony ringtones sharp ringtones sonyericsson ringtones ortho online levitra cheap prozac zyban online sharp ringtones nokia ringtones mono ringtones buy rivotril free jazz ringtones lisinopril online norco online cheap ativan free kyocera ringtones levitra online cheap xanax cool ringtones cialis online levitra cheap tramadol cheap vicodin [[http://people.msoe.edu/~millerni/forums.php?show=topic

Deletions:
levitra cheap tramadol cheap vicodin wellbutrin online qwest ringtones propecia online free polyphonic ringtones free cool ringtones free polyphonic ringtones free mono ringtones hydrocodone online cheap adipex free alltel ringtones cheap valium cheap tenuate phentermine online cheap alprazolam cheap flexeril buy hgh online meridia cheap ultram free free ringtones free funny ringtones cheap diethylpropion free qwest ringtones real ringtones lipitor online cheap ultracet tramadol online cheap cialis sony ericsson ringtones funny ringtones zoloft online free music ringtones cheap carisoprodol zanaflex online free nokia ringtones but lortab motorola ringtones free samsung ringtones alltel ringtones free sharp ringtones cheap soma mtv ringtones cheap levitra pharmacy online online real ringtones ambien online cheap diethylpropion cheap xanax lorazepam real ringtones punk ringtones buy albuterol cheap xanax fioricet online cheap didrex verizon ringtones buy ultracet free tracfone ringtones cheap clomid ativan buy xanax nexium online sonyericsson ringtones cheap clomid adipex online online cialis cheap hydrocodone cheap levitra midi ringtones order lisinopril free wwe ringtones cheap phentermine free tracfone ringtones cheap sildenafil free verizon ringtones free midi ringtones buy phentermine rivotril online vicodin cheap celexa free funny ringtones cheap flexeril hoodia online cheap tenuate buy prozac sprint ringtones cheap norco meridia online sprint ringtones diazepam online fioricet online mp3 ringtones paxil online buy zanaflex cheap alprazolam soma online order diazepam wwe ringtones but zoloft lorazepam online online norco free ringtones cheap carisoprodol free qwest ringtones clonazepam online celexa online cheap clonazepam buy lipitor nokia ringtones cheap lisinopril cheap propecia nokia ringtones punk ringtones carisoprodol online ultram online free sony ericsson ringtones free tracfone ringtones zyban online hoodia online tramadol online free cingular ringtones free jazz ringtones alltel ringtones flexeril nextel ringtones free kyocera ringtones samsung ringtones motorola ringtones cheap meridia xenical online free sony ringtones cheap paxil free sagem ringtones buy ativan rivotril online ortho online cheap celexa free sharp ringtones cheap adipex cheap ortho cheap hydrocodone propecia online cingular ringtones nextel ringtones free sagem ringtones adipex punk ringtones buy didrex sonyericsson ringtones didrex online cheap diazepam free samsung ringtones free sharp ringtones meridia online mono ringtones valium online hgh online free nextel ringtones funny ringtones lortab online but ultracet viagra online albuterol vicodin online motorola ringtones lorazepam online free ericsson ringtones mp3 ringtones free sonyericsson ringtones viagra online cyclobenzaprine online but vigrx wwe ringtones cheap zoloft clomid online fioricet online free samsung ringtones albuterol online tramadol online order xenical online alprazolam cheap clonazepam free mp3 ringtones cheap norco xanax mtv ringtones free qwest ringtones valium cheap sildenafil zyban online alprazolam online online levitra cheap soma cheap ortho xenical online zyban online polyphonic ringtones motorola ringtones

Regular Expression FAQ list


How do I parse HTML/XML?
Read How to parse HTML....
Here is a short list of HTML parsers for popular languages. XML parsers seem to be easy enough to find.
For UNIX command line tools (awk, sed, etc), consider converting HTML to XHTML using Tidy and then to PYX using XMLStarlet.
 ## extract all hyperlinks
<bookmark.htm  tidy -asxhtml 2>/dev/null  | xmlstarlet pyx  | sed '/^(a/,/^)a/!d;/^Ahref /!d;s///' 

How do I match a URL?

How do I match text which doesn't match a pattern?
How do I negate a match?
Ideally, you'll want to use the features of your language or application software to do this. Here are some examples:
Perl:
$str !~ m/foo/

PHP:
if (!preg_match("/foo/", $string))

sed:
 /foo/d

vi:
 :v/foo/p

mod_rewrite:
!/foo/

grep:
 grep -v foo

If you cannot use such a technique because your application (e.g. a text editor) does not allow that level of programmability, you may be able to get by with an expression such as:
 /^(?!.*foo)/s
Note however that this may be much slower than the equivalent negated expression.

How do I match text which contains words in any order?
How do I match text which matches more than one pattern?
This is another of those situations where regular expressions alone are not enough. The best way is to match the line against multiple patterns:
Perl: %%(perl) if ($str =~ m/foo/



Edited on 2007-07-07 04:52:39 by QdkZ5j

Additions:
levitra cheap tramadol cheap vicodin wellbutrin online qwest ringtones propecia online free polyphonic ringtones free cool ringtones free polyphonic ringtones free mono ringtones hydrocodone online cheap adipex free alltel ringtones cheap valium cheap tenuate phentermine online cheap alprazolam cheap flexeril buy hgh online meridia cheap ultram free free ringtones free funny ringtones cheap diethylpropion free qwest ringtones real ringtones lipitor online cheap ultracet tramadol online cheap cialis sony ericsson ringtones funny ringtones zoloft online free music ringtones cheap carisoprodol zanaflex online free nokia ringtones but lortab motorola ringtones free samsung ringtones alltel ringtones free sharp ringtones cheap soma mtv ringtones cheap levitra pharmacy online online real ringtones ambien online cheap diethylpropion cheap xanax lorazepam real ringtones punk ringtones buy albuterol cheap xanax fioricet online cheap didrex verizon ringtones buy ultracet free tracfone ringtones cheap clomid ativan buy xanax nexium online sonyericsson ringtones cheap clomid adipex online online cialis cheap hydrocodone cheap levitra midi ringtones order lisinopril free wwe ringtones cheap phentermine free tracfone ringtones cheap sildenafil free verizon ringtones free midi ringtones buy phentermine rivotril online vicodin cheap celexa free funny ringtones cheap flexeril hoodia online cheap tenuate buy prozac sprint ringtones cheap norco meridia online sprint ringtones diazepam online fioricet online mp3 ringtones paxil online buy zanaflex cheap alprazolam soma online order diazepam wwe ringtones but zoloft lorazepam online online norco free ringtones cheap carisoprodol free qwest ringtones clonazepam online celexa online cheap clonazepam buy lipitor nokia ringtones cheap lisinopril cheap propecia nokia ringtones punk ringtones carisoprodol online ultram online free sony ericsson ringtones free tracfone ringtones zyban online hoodia online tramadol online free cingular ringtones free jazz ringtones alltel ringtones flexeril nextel ringtones free kyocera ringtones samsung ringtones motorola ringtones cheap meridia xenical online free sony ringtones cheap paxil free sagem ringtones buy ativan rivotril online ortho online cheap celexa free sharp ringtones cheap adipex cheap ortho cheap hydrocodone propecia online cingular ringtones nextel ringtones free sagem ringtones adipex punk ringtones buy didrex sonyericsson ringtones didrex online cheap diazepam free samsung ringtones free sharp ringtones meridia online mono ringtones valium online hgh online free nextel ringtones funny ringtones lortab online but ultracet viagra online albuterol vicodin online motorola ringtones lorazepam online free ericsson ringtones mp3 ringtones free sonyericsson ringtones viagra online cyclobenzaprine online but vigrx wwe ringtones cheap zoloft clomid online fioricet online free samsung ringtones albuterol online tramadol online order xenical online alprazolam cheap clonazepam free mp3 ringtones cheap norco xanax mtv ringtones free qwest ringtones valium cheap sildenafil zyban online alprazolam online online levitra cheap soma cheap ortho xenical online zyban online polyphonic ringtones motorola ringtones

Regular Expression FAQ list

Perl: %%(perl) if ($str =~ m/foo/


Deletions:

Regular Expression FAQ list

Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s




Edited on 2007-07-05 10:26:23 by MarkEdgar [Oops, I meant to restore this version.]

Additions:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s


Deletions:
Perl: %%(perl) if ($str =~ m/foo/



Edited on 2007-07-05 10:20:32 by MarkEdgar

Additions:

Regular Expression FAQ list



Deletions:
buy diazepam order tramadol wellbutrin online free jazz ringtones cheap rivotril free mtv ringtones cheap lipitor cheap celexa ativan online free nokia ringtones order norco motorola ringtones but ultram cheap ultram norco online mono ringtones cheap celexa buy didrex online pharmacy cheap propecia cheap phentermine viagra online vicodin online sildenafil cheap lisinopril sharp ringtones online levitra free funny ringtones but hydrocodone valium free cool ringtones clonazepam online cyclobenzaprine online verizon ringtones hgh online cheap ambien free sony ringtones cialis online free cingular ringtones cheap cialis cheap prozac qwest ringtones cheap didrex free punk ringtones jazz ringtones free ringtones ultracet flexeril online nokia ringtones cheap ativan cheap viagra midi ringtones free sony ericsson ringtones free real ringtones cheap adipex free funny ringtones punk ringtones cheap tenuate meridia free kyocera ringtones free sprint ringtones meridia online cheap tenuate clomid online ambien online free sonyericsson ringtones clomid online music ringtones ericsson ringtones cheap levitra wwe ringtones kyocera ringtones nexium online free mp3 ringtones cheap hgh cheap xanax sagem ringtones xenical online but alprazolam free music ringtones zanaflex online verizon ringtones free nextel ringtones tracfone ringtones buy diethylpropion cheap albuterol tramadol online samsung ringtones free mp3 ringtones free wwe ringtones soma online free sharp ringtones lisinopril online paxil online motorola ringtones samsung ringtones vigrx online cheap sildenafil buy paxil cheap zanaflex cheap rivotril cheap diethylpropion sprint ringtones polyphonic ringtones free sagem ringtones cheap nexium cingular ringtones cheap cyclobenzaprine cheap pharmacy online free alltel ringtones sonyericsson ringtones sony ericsson ringtones cheap diazepam online vicodin lipitor online cheap vigrx free mtv ringtones soma online buy lorazepam real ringtones cheap zyban albuterol online ericsson ringtones lorazepam online cheap zoloft but adipex wellbutrin online free alltel ringtones free cool ringtones nextel ringtones online zoloft clonazepam online valium online order fioricet free midi ringtones xanax online free polyphonic ringtones buy hoodia cheap lortab alprazolam online cheap hydrocodone lortab online cheap ultracet free ringtones mono ringtones carisoprodol online free sony ringtones ortho online free tracfone ringtones phentermine ortho online xenical online prozac online carisoprodol online cheap propecia flexeril free qwest ringtones fioricet online cheap hoodia cheap zyban

Regular Expression FAQ list





Edited on 2007-07-04 13:17:17 by QdkZ5j

Additions:
buy diazepam order tramadol wellbutrin online free jazz ringtones cheap rivotril free mtv ringtones cheap lipitor cheap celexa ativan online free nokia ringtones order norco motorola ringtones but ultram cheap ultram norco online mono ringtones cheap celexa buy didrex online pharmacy cheap propecia cheap phentermine viagra online vicodin online sildenafil cheap lisinopril sharp ringtones online levitra free funny ringtones but hydrocodone valium free cool ringtones clonazepam online cyclobenzaprine online verizon ringtones hgh online cheap ambien free sony ringtones cialis online free cingular ringtones cheap cialis cheap prozac qwest ringtones cheap didrex free punk ringtones jazz ringtones free ringtones ultracet flexeril online nokia ringtones cheap ativan cheap viagra midi ringtones free sony ericsson ringtones free real ringtones cheap adipex free funny ringtones punk ringtones cheap tenuate meridia free kyocera ringtones free sprint ringtones meridia online cheap tenuate clomid online ambien online free sonyericsson ringtones clomid online music ringtones ericsson ringtones cheap levitra wwe ringtones kyocera ringtones nexium online free mp3 ringtones cheap hgh cheap xanax sagem ringtones xenical online but alprazolam free music ringtones zanaflex online verizon ringtones free nextel ringtones tracfone ringtones buy diethylpropion cheap albuterol tramadol online samsung ringtones free mp3 ringtones free wwe ringtones soma online free sharp ringtones lisinopril online paxil online motorola ringtones samsung ringtones vigrx online cheap sildenafil buy paxil cheap zanaflex cheap rivotril cheap diethylpropion sprint ringtones polyphonic ringtones free sagem ringtones cheap nexium cingular ringtones cheap cyclobenzaprine cheap pharmacy online free alltel ringtones sonyericsson ringtones sony ericsson ringtones cheap diazepam online vicodin lipitor online cheap vigrx free mtv ringtones soma online buy lorazepam real ringtones cheap zyban albuterol online ericsson ringtones lorazepam online cheap zoloft but adipex wellbutrin online free alltel ringtones free cool ringtones nextel ringtones online zoloft clonazepam online valium online order fioricet free midi ringtones xanax online free polyphonic ringtones buy hoodia cheap lortab alprazolam online cheap hydrocodone lortab online cheap ultracet free ringtones mono ringtones carisoprodol online free sony ringtones ortho online free tracfone ringtones phentermine ortho online xenical online prozac online carisoprodol online cheap propecia flexeril free qwest ringtones fioricet online cheap hoodia cheap zyban

Regular Expression FAQ list



Deletions:

Regular Expression FAQ list





Edited on 2007-06-29 11:51:34 by FkbB3d

Additions:
Perl: %%(perl) if ($str =~ m/foo/

Deletions:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)
PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s




Edited on 2007-05-23 14:41:25 by FelipePena

Additions:
- PHP: SimpleXML



Edited on 2007-04-20 16:57:18 by MarkEdgar [revert accidental(?) deletion]

Additions:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s


Deletions:
Perl: %%(perl) if ($str =~ m/foo/



Edited on 2007-04-19 22:07:36 by RqeMcg

Additions:
Perl: %%(perl) if ($str =~ m/foo/

Deletions:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

grep:
 grep foo | grep bar

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s




Edited on 2007-01-19 10:36:13 by MarkEdgar [XMLStarlet provides PYX and more]

Additions:
For UNIX command line tools (awk, sed, etc), consider converting HTML to XHTML using Tidy and then to PYX using XMLStarlet.
 ## extract all hyperlinks
<bookmark.htm  tidy -asxhtml 2>/dev/null  | xmlstarlet pyx  | sed '/^(a/,/^)a/!d;/^Ahref /!d;s///' 


Deletions:
For UNIX command line tools (awk, sed, etc), consider converting HTML to XHTML using HTML Tidy (or another converter) and then using the XMLN tool from Pyxie.



Edited on 2006-11-07 13:10:00 by MarkEdgar [formatting]

Additions:
How do I match text which matches more than one pattern?


Deletions:
How do I match text which matches more than one pattern?




Edited on 2006-11-07 13:05:45 by MarkEdgar [add grep]

Additions:
grep:
 grep -v foo
grep:
 grep foo | grep bar




Edited on 2006-06-06 13:05:35 by MarkEdgar [Updated HTML section]

Additions:
Read How to parse HTML....
Here is a short list of HTML parsers for popular languages. XML parsers seem to be easy enough to find.
For UNIX command line tools (awk, sed, etc), consider converting HTML to XHTML using HTML Tidy (or another converter) and then using the XMLN tool from Pyxie.


Deletions:
http://htmlparsing.icenine.ca/
A short list of HTML parsers for popular languages. XML parsers are easy enough to find.

How do I parse HTML/XML?
http://htmlparsing.icenine.ca/
A short list of HTML parsers for popular languages. XML parsers are easy enough to find.

How do I match a URL?

How do I match text which doesn't match a pattern?
How do I negate a match?
Ideally, you'll want to use the features of your language or application software to do this. Here are some examples:
Perl:
$str !~ m/foo/

PHP:
if (!preg_match("/foo/", $string))

sed:
 /foo/d

vi:
 :v/foo/p

mod_rewrite:
!/foo/

If you cannot use such a technique because your application (e.g. a text editor) does not allow that level of programmability, you may be able to get by with an expression such as:
 /^(?!.*foo)/s
Note however that this may be much slower than the equivalent negated expression.

How do I match text which contains words in any order?
How do I match text which matches more than one pattern?
This is another of those situations where regular expressions alone are not enough. The best way is to match the line against multiple patterns:
Perl:
if ($str =~ m/foo/ && $str =~ m/bar/)

PHP:
if (preg_match("/foo/", $string) && preg_match("/bar/", $string))

sed:
 /foo/!d;/bar/!d

Again, if you cannot use such a technique, try
 /^(?=.*foo)(?=.*bar)/s
Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.1264 seconds