Janek Schleicher wrote: > Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +0000: > > > > > I'm afraid your regex is wrong! It does the following: > > Yep, it was a typo and untested. > > > capture zero or more (as few as possible) of any character > > !! match one or more 'word' characters followed by an open parenthesis > > capture zero or more (as many as possible) of any character > > match a close parenthesis > > Replace the \w+ with a \s* like of Stefan suggested, > an everything works fine :-) > > The main advantage of a regexp solution against a split solution is that > it will also work with something like > $data = "Janek Schleicher (The (not yet) perfect regexp man :-))"
But whether or not that's useful depends on the content and quality of the data. This won't match paired parentheses, and will fail to work at all if the closing parenthesis is missing. Without any more information the simplest solution possible is the best one, so I'll stick with my 'split' call for now :-) Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
