<Original message>
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tue, Sep 04, 2001 at 07:48:27PM +0200
Message-ID: <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>

</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: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to