This is my starting regex that is not working:
'/^(DO)(?<cmd>.{1,6})$/'
The expression should match any string starting with ‘DO’, the string after ‘DO’ must be of minimum 1 and max 6 characters in length.
What I expect:
DO // NOT A MATCH
DO123 // MATCH
DOaaa123 // MATCH
DOaaa123b // NOT A MATCH
?<cmd>
is a named subpattern: matches are stored as associative array.
Seems like it’s a back compatibility problem, although the documentation changelog says:
Using PHP 5.4.8, windows IIS
This works fine: