Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by Athanasius (Archbishop)
on Mar 03, 2018 at 09:25 UTC ( [id://1210274]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        # put commas in the right places in an integer
        1 while s/(\d)(\d\d\d)(?!\d)/$1,$2/g;
    
        # expand tabs to 8-column spacing
        1 while s/\t+/' ' x (length($&)*8 - length($`)%8)/e;
    
  2. or download this
    my $foo = ':{,"';
    1 while $foo =~ s/([:,{])(?! )(.)/$1 $2/;
    print ">$foo<\n";
    
  3. or download this
    19:22 >perl 1872_SoPW.pl
    >: { , "<
    
    19:22 >
    

Log In?
Username:
Password:

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

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

    No recent polls found