Re: regex brain-toot
| From: | John Nichel | Date: | Mon, 19 Jun 2006 19:26:57 +0000 |
| Subject: | Re: regex brain-toot | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238317@lists.php.net to get a copy of this message | ||
Jay Blanchard wrote:
[snip] Ahhhh....not PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs ); [/snip] Still returns parentheses ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs ); gets rid of opening bracket, but ereg("[^\(][0-9\.]*[^\)]" , "Upper Voltage (124.1)", $regs ); doesn'tDo you have to use ereg? The preg_match pattern I posted works fine. It will return an array, first element being the whole string it matched, next element will be what it matched _inside_ the parentheses (less the parentheses) (if it matches anything that is). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com