On Jun 2, Siegfried Heintze said:
s/\bJr\b/ Junior /gi;
This is not exactly what I want because it will put a space before "Junior"
even if Junior is at the beginning and I don't want a space?
Just do
s/\bJr\b/Junior/gi;
The \b is an anchor -- it matches a location, not a character.
--
J
e an easier way?
Thanks,
Siegfried
-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 02, 2005 7:04 PM
To: Siegfried Heintze
Cc: beginners@perl.org
Subject: Re: Seaching for Words at the beginning of the line and end of line
On Jun 2, Siegfried
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'".
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$/.
Thanks,
Siegfried