perl question
Parker Thompson
parkert at u.washington.edu
Sun Feb 27 19:18:56 PST 2000
Try this:
$input =~ /\blin\b/;
This will match lin but not linux or gamblin. The \b char requires that
there be a word boundary for the reg exp to be true.
Check out the section on regular expressions in Programming Perl, it's
straight-up dope-fly.
Parker.
-----------------------------------------------------------------------
"It took the computing power of three C-64s to fly to the Moon.
It takes a 486 to run Windows 95. Something is wrong here."
On Sun, 27 Feb 2000, Greg Daly wrote:
:hey all,
:not explicitly linux, but close. i'm trying to match occurences of a
:string in perl. problem is, i only want occurences of that string
:specifically to ring a true. example, say i have this list:
:
:linux
:linus
:
:$input=~/lin/ will give me a TRUE, even though I only want it to ring
:true IFF there exists an entry named 'lin'.
:
:see what i mean? any suggestions? is there a switch i don't know about?
:thanks,
:-greg
:
:
:
:
More information about the Linux
mailing list