in reply to How can I match this }\n} in perl

Without more information, that regex would work. Is it perhaps there's whitespace you're not accounting for, since it looks like you're searching for braces that end a block?

If that's the case, I think you would want /}\n\w*}/ There's also a possibility you're editing a document from another filesystem, and newline is defaulting to your system. /}\n\r?}/ catches both Linux-y/Windows line endings.

Replies are listed 'Best First'.
Re^2: How can I match this }\n} in perl
by haukex (Archbishop) on Feb 22, 2019 at 20:08 UTC
    whitespace you're not accounting for ... If that's the case, I think you would want /}\n\w*}/

    That should probably be /}\n\s*}/, since \w means a word character.

    /}\n\r?}/

    That should probably be /}\r?\n}/, since \n\r would be LFCR (see also).

      Thanks. I don't use regex too often anymore but I mostly remember it!