Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Golf: Replacing part of a string with "*"

by jwkrahn (Abbot)
on Aug 18, 2006 at 15:48 UTC ( [id://568205]=note: print w/replies, xml ) Need Help??


in reply to Golf: Replacing part of a string with "*"

$ perl -le' my $string = q/5424123412345678/; $string =~ s/.(?=.{4})/*/g; print $string;' ************5678 Update: $ perl -le' my $string = q/5424123412345678/; $string =~ s/(?<=.{4}).(?=.{4})/*/g; print $string;' 5424********5678

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found