Jaschar Otto wrote at Wed, 11 Jun 2003 11:53:11 +0200:

> i've got a problem with regexp,
> i have a multiline string like
> 
> this is
> a multi
> line string
> 
> 
> 
> and i want to do a regexp that replaces
> everything that is NOT "a","b","c"  or "d"
> with \s, except \n of course.

\s is not one character, it stands usually for a whole character class!
Do you mean an empty string ("") or just a blank (" ") instead?

> i got something like
> 
> $string =~ s/![abcd]//g;

character class negation works with [^...],
in your case it would be
$string =~ s/[^abcd]//g;

> but that doesn't work, maybe because
> it recognizes ! not as negation but as
> character...
> so how to do it ?

Please read also
perldoc perlre
for details.


Greetings,
Janek

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

Reply via email to