Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

(elbie): substr and strings on the outside

by elbie (Deacon)
on Aug 19, 2001 at 20:20 UTC ( #106033=note: print w/replies, xml ) Need Help??


in reply to substr and strings on the outside

Regex search and replace:

my $f = " "; $f =~ s/^(.{0,5}).{0,5}/${1}12345/;

The only problem is this regex doesn't pad extra spaces if your string is too short, but at least it still does the replacement.

elbieelbieelbie

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2016-09-25 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (474 votes). Check out past polls.