in reply to Split on whitespace or other criteria

Just curious ... why do people seem to use

/(?=\-)/
... in regex, instead of ...
/[\-]/

Is the latter variant inferior? going out of style?

Replies are listed 'Best First'.
Re^2: Split on whitespace or other criteria
by Roy Johnson (Monsignor) on Jan 30, 2005 at 23:12 UTC
    The former is a lookahead; it does not eat a character. The latter consumes the "-". Oh, there's no need to backslash it.

    Caution: Contents may have been coded under pressure.