kidd has asked for the wisdom of the Perl Monks concerning the following question:
I have this code that makes a search trough a lot of texts. I finished it and I tested but the I saw something, when I searched for lets say "foo" it returned true to either "foo" and "foobar"... I didnt want that! I wanted only to be true to "foo" nothing more nothing less.
So, I decided to make a correction and I edited this line:
tomy $count = grep{ /$query/ } $_;
my $count = grep{ /\b$query\b/ } $_;
And if you could tell me how can I make the search not case-sensitive...
I thought that maybe I could do that like this:
my $count = grep{ /\b$query\b/i } $_;
THANKS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp bug
by hotshot (Prior) on Aug 27, 2002 at 15:24 UTC | |
|
Re: regexp bug
by thelenm (Vicar) on Aug 27, 2002 at 17:10 UTC |