RE: [PHP] REGEX: grouping of alternative patterns

From: Date: Tue, 30 Oct 2007 12:33:09 +0000
Subject: RE: [PHP] REGEX: grouping of alternative patterns
Groups: php.general 
Request: Send a blank email to php-general+get-263811@lists.php.net to get a copy of this message
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*(`. > *`|[0-9]*)?)?))\s*/i Since all the parts beyond the id and datatype are optional, I don't see how this can ever not match. Please define more accurately what you mean by "doesn't match". Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

« previous php.general (#263811) next »