in reply to Re: Regex dynamics
in thread Regex dynamics

This is indeed what i wanted. Well it matches the [] as well, but that i can live with no problem :). Thank you.

Replies are listed 'Best First'.
Re: Re: Re: Regex dynamics
by borisz (Canon) on Feb 11, 2004 at 09:47 UTC
    I did not read carefull enough. Try this line.
    my $q; $q = qr/(?:\[(?:(?>[^\[\]]+)|(??{$q}))+\])/;
    Boris
      Ah, my bad on last post :P. Meant that the [] are captured (not matched as written there).
      t[tag]: happens $1 == t $2 == [tag] instead of $1 == t $2 == tag
      My bad on explanations. I should be more careful on how to write (or think beforehand instead of just writing... :)).
        ok, but what should happen on cases like this?
        P[[bb]] x[xx[x]] Z[[z]y] X[a[s]x] V[a[b[c[d]f]g]h]
        Boris