Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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


Comment on (elbie): substr and strings on the outside
Download Code

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 having an uproarious good time at the Monastery: (8)
As of 2014-07-12 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls