in reply to Help with Substitution

Use a look-ahead:
$line = "{john{david{mary{{{{martin}"; $line =~ s/{(?=[{}])/{empty/g;


japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: Help with Substitution
by La12 (Sexton) on Jun 28, 2001 at 22:19 UTC
    Thank you, the code worked perfectly. I will be reading up on "look-ahead". Thanks again everyone.