in reply to Re^2: Eugh, regex :(
in thread Eugh, regex :(
Update:I recommend Jeffrey Friedl's "Mastering Regular Expressions". This a "classic". But I figure this like nuclear weapons! The vast majority of regex problems can be solved by shooting the problem 1x or 2x or maybe even 3x with simplex regex'es in a sequence. Also I've found that the performance can be just as fast as a single complex regex (and sometimes faster)!#!/usr/bin/perl -w use strict; my $example = '[URL=http://img207.imageshack.us/my.php?image=dsc03598v +t7.jpg][IMG]http://img207.imageshack.us/img207/2964/dsc03598vt7.jpg[/ +IMG][/URL]'; print "$example \n"; $example =~ s/\[\/*URL.*?\]//g; print $example; #prints [URL=http://img207.imageshack.us/my.php?image=dsc03598vt7.jpg][IMG]htt +p://img207.imageshack.us/img207/2964/dsc03598vt7.jpg[/IMG][/URL] [IMG]http://img207.imageshack.us/img207/2964/dsc03598vt7.jpg[/IMG]
|
|---|