Next Regular Expression Mastery 93

Digression for a Practical Application

        s/x.*//;                # WRONG
        s/(.*)x.*/$1/;          # Right, but slow
        s/x[^x]*//;             # WRONG
        s/x[^x]*$//;            # Ahhhh.  (1/3 faster)


Next Copyright © 2002 M. J. Dominus