[PHP] REGEX: grouping of alternative patterns

2007-10-30 Thread Stijn Verholen
Hey list, I'm having problems with grouped alternative patterns. The regex I would like to use, is the following: /\s*(`?.+`?)\s*int\s*(\(([0-9]+)\))?\s*(unsigned)?\s*(((auto_increment)?\s*(primary\s*key)?)|((not\s*null)?\s*(default\s*(`.*`|[0-9]*)?)?))\s*/i It matches this statement: `id`

Re: [PHP] REGEX: grouping of alternative patterns

2007-10-30 Thread Robin Vickery
On 30/10/2007, Stijn Verholen [EMAIL PROTECTED] wrote: Hey list, I'm having problems with grouped alternative patterns. The regex I would like to use, is the following:

RE: [PHP] REGEX: grouping of alternative patterns

2007-10-30 Thread Ford, Mike
On 30 October 2007 11:07, Stijn Verholen wrote: Hey list, I'm having problems with grouped alternative patterns. The regex I would like to use, is the following: /\s*(`?.+`?)\s*int\s*(\(([0-9]+)\))?\s*(unsigned)?\s*(((auto_i ncrement)?\s*(primary\s*key)?)|((not\s*null)?\s*(default\s*(`.

Re: [PHP] REGEX: grouping of alternative patterns [SOLVED]

2007-10-30 Thread Stijn Verholen
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