so, if a character is inside of square brackets [], then perl recognizes
that it is part of a character class and never uses it as a quantifier or
special character??

-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:04 PM
To: McCollum, Frank
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: global substitution


On Jan 7, McCollum, Frank said:

>$record =~ s/[\.\-]//g;

Neither of those two slashes are needed.

>if it is a '.' or a '-' replace it with nothing.
>Actually, I don't even think the [] is necessary, so it could just be:
>$record =~ s/\.\-//g;

No, the [...] is needed.  Otherwise, you're removing all occurrences of
the string ".-" which is not what was intended.

So s/[.-]+//g, or perhaps tr/.-//d;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.

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

Reply via email to