Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(elbie): substr and strings on the outside

by elbie (Curate)
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
Domain Nodelet?
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 about the Monastery: (5)
As of 2021-10-24 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?