Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: When a regexp with /g needs to be run .. twice

by QM (Parson)
on Mar 05, 2018 at 10:07 UTC ( [id://1210345]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $foo = ':{"';
    $foo =~ s/([:,{])(.)/$1 $2/g;
    print "'$foo'\n";
    
  2. or download this
    1 while $foo =~ s/([:,{])([^ ])/$1 $2/g; # [^ ] is "not space"
    
  3. or download this
    1 while $foo =~ s/([:,{])([^ ]|$)/$1 $2/g;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-24 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found