Re: Re: regexp: 'a correctly parenthesized substring advanced'
| From: | Jaaboo | Date: | Tue, 30 Sep 2003 12:11:26 +0000 |
| Subject: | Re: Re: regexp: 'a correctly parenthesized substring advanced' | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164385@lists.php.net to get a copy of this message | ||
hi marek,
thanx for your suggestion.
i have tried out the tokenizer but
1. i think its not realy final and can change in the future
2. the tokenizer can only find real php code but i need to find my
simplified php code without an ; on the end of an statement for example.
so the tokenizer doesn't do my job. i'm not far from the right solution it's
a litle step to bring the regex working with embeded parenthesis beetween "
"
i only had 2pregs in the complete source that can catch any type of
registered function call with the simplified syntax ... this is fast enough
for me ...
"Marek Kilimajer" <kilimajer@webglobe.sk> schrieb im Newsbeitrag
news:3F796BFD.1070108@webglobe.sk...
> Forget regexp and try this function:
> http://sk.php.net/manual/en/function.token-get-all.php
>
> Jaaboo wrote:
>
> > I give an wrong example. Here is a better one
> >
> > <?php
> >
> > $txt = "func1($par1," 100 (euro)", func2($par2,"(c) by
> > nobody"))";
> >
> > if (preg_match_all('
> >
> > /
> >
> > ([a-zA-Z]\w*?)
> >
> > \s*
> >
> > (
> >
> > \(
> >
> > (
> >
> > (?>.*?)|
> >
> > .*?(?R)*
> >
> > )
> >
> > \)
> >
> > )+
> >
> > /x
> >
> > ', $txt, $m)){
> >
> > print_r($m);
> >
> > } else {
> >
> > echo "no match";
> >
> > }
> >
> > echo "\n";
> >
> >
> >
> > ?>
> >
> > This must result in :
> >
> > First call: func1($par1," 100 (euro)", func2($par2,"(c) by nobody"))
> > Second call with the inner part $par1," 100 (euro)", func2($par2,"(c) by
> > nobody")
> > must result in : func2($par2,"(c) by nobody")
> >
> >
> >
> > Please visit www.regexp.org there is an open thread of this question.
> >
> > thanx
> >