Is str ~ regex the root of all evil, or the leaf of all good?

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Feb 19 07:47:41 PST 2009


On Thu, Feb 19, 2009 at 10:01 AM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:

>> RE attributes:
>> "repeat", "r": Repeat over the whole input string
>> "ignorecase", "i": case insensitive
>> "multiline", "m": treat as multiple lines separated by newlines
>> "verbose", "v": ignores space outside [] and allows comments
>
> And how do you combine them? "repeat, ignorecase"? Writing and parsing such
> options becomes a little adventure in itself. I think the "g", "i", and "m"
> flags are popular enough if you've done any amount of regex programming. If
> not, you'll look up the manual regardless.

While we're on the subject I'd like to mention that an unbelievably
overwhelming proportion of the time, when I use regexen, I want them
to be global.  As in, I don't think I've ever used a non-global regex.

To that effect I'd like to propose that either "g" be the default
attribute, or that it should be on _unless_ some other attribute ("o"
for once?) is present.  I think this is one thing that Perl got
terribly wrong.



More information about the Digitalmars-d mailing list