On Jun 2, Siegfried Heintze said:

How do I search for the word "intern" without searching for "internal"?

What I have been doing is /intern[^a]/ but that won't match /intern$/.

You want to use a negative look-ahead:

  /intern(?!al)/

That means "match 'intern' that is not followed by 'al'". But perhaps you just want to use word boundaries?

  /\bintern\b/

That will only match "intern" when there are no word characters to the left or right of it. Thus, "I am an intern" will match, but "internal problems" and "abintern" won't match. ("Abintern" isn't a word, but I wanted to prove a point.)

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to