bestresearch2 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl $teststr1='perl.org'; $teststr2='perl .org'; $termstr1='.org'; $termstr2='perl'; # I don't want to find 'perl' in 'perl.org' if ($teststr1 =~ m/\b$termstr2\b/) { print "uggh1\n"; } # I don't want to find '.org' in 'perl.org' if ($teststr1 =~ m/\b$termstr1\b/) { print "uggh2\n"; } # I DO want to find '.org' in 'perl .org' if ($teststr2 =~ m/\b$termstr1\b/) { print "hurray1\n"; } # I DO want to find 'perl' in 'perl .org' if ($teststr2 =~ m/\b$termstr2\b/) { print "hurray2\n"; } >...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with matching .org
by moritz (Cardinal) on Jan 09, 2008 at 14:58 UTC | |
by bestresearch2 (Novice) on Jan 09, 2008 at 15:11 UTC | |
by bestresearch2 (Novice) on Jan 09, 2008 at 16:02 UTC | |
by johngg (Canon) on Jan 09, 2008 at 17:21 UTC | |
|
Re: Help with matching .org
by poolpi (Hermit) on Jan 10, 2008 at 11:34 UTC |