Robin Vickery schreef:
[snip]
Because each of your subpatterns can match an empty string, the
lefthand subpattern always matches and the righthand subpattern might
as well not be there.
Indeed they do, i did not realise that.
The simplest solution, if you don't want to completely rethink your
regexp might be to replace \s with [[:space:]], remove the delimiters
and the i modifier and just use eregi(). like so:
Because this is for a proof-of-concept application that will only be
used by me for the time being, and because I always give a default value
when specifying 'not null', I'm going to use the following, and think
about a more general solution if and when the need arises.
This matches both my cases:
/\s*(`?.+`?)\s*int\s*(\(([0-9]+)\))?\s*(unsigned)?\s*(((not\s*null)\s*(default\s*(`.*`|[0-9]*)?))|((auto_increment)?\s*(primary\s*key)?))\s*/i
[snip]
-robin
Thanks for your insights, Robin !
Greetz,
Stijn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php