in reply to Re: Resetting pos() within a RegEx?
in thread Resetting pos() within a RegEx?

But if I'm allowed to execute code, than the constraint "do it in a single regexp" isn't a constraint at all.
So here we go with 3 regexps and no code execution (exept for initializing and printing):

$_="x" x 30; s:xx:$' $`$&\n:g; s:(?<=\n).*:$&$`$`:s; s/xx(?=(x*)(\1) )/ /g; print;

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^3: Resetting pos() within a RegEx?
by LanX (Saint) on Jan 11, 2009 at 17:44 UTC
    Still many bytes, but I really like your approach of taking the postmatch to indend the substitution! =)

    like this it's quick and easy to get the triangular part of the tree!!!

    DB<<70>> $_=$"x15;s: :$'#$`$`#\n:g;print ## # # # # # # # # # # # # # # # # # # # # # # # # # # # # DB<<71>> $_=$"x15;s: :$_=$`;y/ /#/;"$'$_$_\n":ge;print ## #### ###### ######## ########## ############ ############## ################ ################## #################### ###################### ######################## ########################## ############################