in reply to regex escaping forward slash in regex

What's with "\s*?"? Don't you simply mean "\s*"?

Anyway,

s/ (?<!_) ( split \s* \( \s* ) ( " (?:[^\\"]+|\\.)* " | ' (?:[^\\']+|\\.)* ' ) / my @x = ($1,$2); $x[1] =~ s{/}{\\/}g; "preg_$x[0]$x[1]" /xesg

Untested.

Will create an error if the "/" is already escaped.