We don't bite newbies here... much | |
PerlMonks |
Wierd Regex stuff..by Speedfreak (Sexton) |
on May 21, 2000 at 16:25 UTC ( [id://14018]=perlquestion: print w/replies, xml ) | Need Help?? |
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
Back to
Seekers of Perl Wisdom
|
|