Speedfreak has asked for the wisdom of the Perl Monks concerning the following question:
Hej igen alla,
O.K, this time I've got a wierd regex problem. I thought I was doing this right but I guess not...
I'm parsing through a text file, line by line looking for a match on names. The actual list is airport names so I enter in "rlanda" as the string to match (partial name).
My logic is as follows:
if ($lines1 =~ /$search*/i) {
print $lines[0]." - ".$lines1."\n";
}
It appears to work, matching regardless of case. However I'm getting very close but not exact matches. Heres a list of what (according to my logic) matches.
Summerland Automatic Weather Reporting System Westerland / Sylt Orland Iii Stockholm / Arlanda Latrobe / Westmorland Orlando, Orlando International Airport Orlando, Orlando Executive Airport Orlando / Sanford Airport Worland, Worland Municipal Airport Uberlandia
It matching those with "rland" but why is it not using the last "a" in "rlanda" to filter it to just "Arlanda". Is it something to do with *?
Can anyone point out what the hell I'm doing wrong?
- Jed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Wierd Regex stuff..
by cciulla (Friar) on May 21, 2000 at 17:08 UTC | |
by dempa (Friar) on May 21, 2000 at 17:12 UTC | |
|
Re: Wierd Regex stuff..
by Anonymous Monk on May 22, 2000 at 16:16 UTC | |
|
RE: Wierd Regex stuff..
by ZZamboni (Curate) on May 22, 2000 at 17:51 UTC | |
|
Re: Wierd Regex stuff..
by justinNEE (Monk) on May 21, 2000 at 22:14 UTC |