in reply to Re: Regex: Specifying quantity for bracketed items
in thread Regex: Specifying quantity for bracketed items

Actually, that doesn't limit you to 5..12, that matches anything with at least 5 lowercases or digits in a row. Any more than 12 just get sucked into the .* after it. Which makes it equivalent to
/ ^(?![ ]) # Doesn't start with a space .*? # Anything [a-z0-9]{5} # Has 5 lowercases or digits in a row .* # Anything (possibly more lowercases or digits) (?<![ ])$ # Doesn't end with a space /x

Replies are listed 'Best First'.
Re^3: Regex: Specifying quantity for bracketed items
by ikegami (Patriarch) on Nov 10, 2004 at 22:10 UTC

    Right you are! Fixed below.

    / ^(?![ ]) # Doesn't start with a space .*? # Anything (?<![a-z0-9]) # For the {5,12} to be meaningful. [a-z0-9]{5,12} # Has a 5..12 lowercases or digits in a row (?![a-z0-9]) # For the {5,12} to be meaningful. .* # Anything (?<![ ])$ # Doesn't end with a space /x