I am trying to replace all occurences of the word St with St. without
generating St.. in the incorrect substitutions of St. 

The code I have been playing with is something like:

$item = "35 Main St." (it could also be "35 Main St" in which case I want
the substitution to happen)

$varS = "st";
$item =~ s/\b$varS(^.|\W)\b/St./gi;

This doesn't work because Perl is expecting a character after the $varS
string, but I don't know how to specify to substitute for the contents of
$varS except when it ends with a period.

Can anyone help?

Thanks in advance.
 

Anya Miretsky
Computer Technology Dept.
Brooklyn Botanic Garden
1000 Washington Avenue
Brooklyn, NY  11225

(718)623-7265
[EMAIL PROTECTED] 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to