RE: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Ted S.
Thomas, Mark - BLS CTR graced perl with these words of wisdom: > For the letter-substitution matches, why not create mini-re for each > one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; > > if ($str =~ /v${i}${a}gr${a}/) { > #it's spam > } > Because Hamster d

Re: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Rob Dixon
Mark Thomas wrote: > > > (i|1|l|\|) to kill the vertical pipe, but I find that much > > harder to read and more difficult to extend later on. > > For the letter-substitution matches, why not create mini-re for each one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; >

RE: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Thomas, Mark - BLS CTR
> (i|1|l|\|) to kill the vertical pipe, but I find that much > harder to read and more difficult to extend later on. For the letter-substitution matches, why not create mini-re for each one? $a = qr/[EMAIL PROTECTED]/; $i = qr/[i1l\|]/; $str = "v|agr@"; if ($str =~ /v${i}${a}gr${a}/) {