Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Replace newlines only if not inside braces

by ww (Bishop)
on Feb 11, 2013 at 14:01 UTC ( #1018148=note: print w/ replies, xml ) Need Help??


in reply to Replace newlines only if not inside braces

As an example, not as a direct response on your specific goal, one way would be to use a negated character class:

C:\>perl -E "use 5.016; use strict; use warnings; my $str='abXcd{X}efXyz'; my @matches; while ($str =~ /[^{](X)[^}]/g) {push @matches, $1;} say @matches;" XX


Comment on Re: Replace newlines only if not inside braces
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018148]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2015-01-28 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (212 votes), past polls