in reply to Re: Can qr be un-compiled?
in thread Can qr be un-compiled?

sub re_p2js { local @_ = @_; for( @_ ) { 1 while s[^\(\?(\w*)-?\w*:(.*)\)$][/$2/$1] } @_ } print for re_p2js qr/abcde/, qr/(1|2)z$/, qr/^abcd*/ims
This will extract the outer (?-xims:) -- and it may be enough for your purposes but, as others already posted, it will not compile perl regexen into js regexen.

UPDATE: changed to respect the flags. The output will be:

/abcde/ /(1|2)z$/ /^abcd*/msi
[]s, HTH, Massa (κς,πμ,πλ)

Replies are listed 'Best First'.
Re^3: Can qr be un-compiled?
by ikegami (Patriarch) on Feb 03, 2009 at 19:57 UTC
    Fails for qr/\//
Re^3: Can qr be un-compiled?
by cosmicperl (Chaplain) on Feb 03, 2009 at 18:57 UTC
    Perfect, thanks :)