Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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

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 chilling in the Monastery: (8)
As of 2016-06-26 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (328 votes). Check out past polls.