in reply to Re: more efficient regular expression please
in thread more efficient regular expression please

That also removes cat.msg, vain.msg, etc. Closer to the original intent (as best as I can tell) would be:

$line =~ s[v?(a?(c?(a?(t?(i?(o?(n?(\.?(m?(­s?g))))))))))][];

                - tye

Replies are listed 'Best First'.
Re: Re^2: more efficient regular expression please (parens)
by BrowserUk (Patriarch) on Jul 03, 2003 at 15:33 UTC

    Your right. It does need brackets. I had another go similar in vein to yours, though I bracketed the other way. Both seem to work, with the same caveat that in the partial insertion is preceded by one or more characters that match the missing part, they get removed also, but without some delimeter, this will always be the case.

    Any thought about which bracketing causes the least amount of work?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller