in reply to want regex to strip "(xxx)"

The last one is almost correct. What you want is not a character class though, and the parens will have to be escaped (the following also eats any whitespace preceeding the superfluous bit, for good measure): $Path =~ s/\s*\(\w+\)$//; Update: Fixed typo. Thanks for the catch, redsquirrel :)

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: regex
by redsquirrel (Hermit) on Jul 23, 2002 at 14:57 UTC
    Oops, you escaped the $ instead of the ), it should read:

    $Path =~ s/\s*\(\w+\)$//;

    --Dave