in reply to Regexp for alphabetical order match within the string

You sound as if you think that
/a*b*c*...y*z*/
isn't an acceptable solution. I think that once you have placed anchors, it's a very fine solution. The regex might be long, it's simple. There are no alternatives. There's no backreferencing. There are no delayed regexes. There will be no backtracking for matching strings, and only minimal backtracking in case of failures. Remember that the less alternatives you give the regexp engine, the faster it (usually) be.

Abigail

Replies are listed 'Best First'.
Re: Re: Regexp for alphabetical order match within the string
by jweed (Chaplain) on Oct 31, 2003 at 21:24 UTC

    I would suggest that you enclose the whole thing in the non-backtracking setup (?>pattern). Since if it doesn't match at first it won't match at all, you can speed up failure by enclosing the whole thing in (?> and ).


    /^(?>a*b*c*...y*z*)$/