Re: urgent. need posix-style regexp expert

From: Date: Wed, 05 Sep 2001 07:47:14 +0000
Subject: Re: urgent. need posix-style regexp expert
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-66009@lists.php.net to get a copy of this message
<Original message> From: alvarez@sto13.st-oneline.de <alvarez@sto13.st-oneline.de> Date: Tue, Sep 04, 2001 at 07:48:27PM +0200 Message-ID: <200109041748.TAA05944@sto13.st-oneline.de> Subject: [PHP] urgent. need posix-style regexp expert > > what is the correct POSIX-regexp to match a range of characters > between two parantheses, while ensuring that it is the largest > match possible? need fast reply. thanks. > > Running against > > (foo (bar (baaz) quux( fred woody) wang)) > > it should return > > foo (bar (baaz) quux( fred woody) wang) > > > > D. Alvarez Arribas <alvarez@st-oneline.net> </Original message> <Reply> Here's your regex: --- PHP Code --- <PRE> <? $myStr = "foo (bar (baaz) quux( fred woody) wang)"; if (ereg ("^[^(]*\((.+)\)[^)]*$", $myStr, $regs)) { print ("Matched!<HR>"); print_r ($regs); } else { print ("No match... sorry!"); } ?> </PRE> --- End of PHP Code --- So the expr to use: ^[^(]*\((.+)\)[^)]*$ </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#66009) next »