[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How to use "/" in a regular expression char class



ERNESTO GONZALEZ <GONZALEZ@Frodo.MGH.Harvard.EDU> writes:
>A quick question (I hope).  I am trying to substitute a "/" with nothing
>(in other words I want get rid of it) using a character class.  From the
>Llama book the following looks like it will work, but it doesn't:
>
>$parameters{'sequence'} =~ s/[\/\-,_]\s+//;

I can never remember the precise rules about delimiters in regexps, so
I change the delimiters (and put the '-' as the first character in the class:

$parameters{'sequence'} =~ s|[-/,_]\s+||;

You might also need the "g" modifier.

Matthias

-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_