quick regex question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Anyone know how to match something wrapped using perl-style regular

e.g. given "function(input, input2, etc)"

How can you match just the inputs? $re = "/function\([^\)]*\)/"; will
match the entire string, but I'd prefer to just
get back the inputs.

Any advice would be greatly appreciated.


Re: quick regex question

On Sat, 27 Sep 2008 05:11:08 -0700 (PDT), Keith Hughitt

Quoted text here. Click to load it

$test = "function(input, input2, etc)";

if ( preg_match("/function\(([^\)]*)\)/", $test, $match) )
    $inputs = preg_split("/[\,\s]+/", $match[1]);

Site Timeline