$_ = '[S [NP This NP] [VP is [NP [NP the turning point NP] [PP to [NP +the left NP] PP] NP] VP] . S]'; #$_ = '[VP This stuff is [NP the left NP] [NP other thing NP] VP]'; @( = ('(',''); @) = (')',''); ($re=$_)=~s/((\[\w+\s*)|(\s*\w+\])|.)/$)[!$3]\Q$1\E$([!$2]/gs; $re = join'|',map{quotemeta}eval{/$re/}; die $@ if $@=~/unmatched/; $_ = (eval{/($re)/})[0]; print join"\n\n",/\s*(\[\w+\s*(?:$re)\s*\w+\]|[^][]*)/g,"";
In reply to Re: Non deliminatd Nested text
by I0
in thread Non deliminatd Nested text
by Dr.Altaica
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |