in reply to Re^4: Regex dynamics
in thread Regex dynamics

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

Replies are listed 'Best First'.
Re^6: Regex dynamics
by Hena (Friar) on Feb 11, 2004 at 14:25 UTC
    P[[bb]] $1: P $2: [bb] x[xx[x]] $1: x $2 xx[x] Z[[z]y] $1: Z $2: [z]y X[a[s]x] $1: X $2: a[s]x V[a[b[c[d]f]g]h] $1: V $2: a[b[c[d]f]g]h
    Also to not forget V[a]C[b] (multiple tags in line) should be allowed as well. So the current one is quite nice (which does pretty much everything). But removing outermost pair of [] is pretty trivial (if done outside the already used regex).
    my ($key,$value)=($1,$2); $value=~s/^\[|\]$//g;
    So as i said i can live with it :).