Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Regex to add space after punctuation sign

by Hena (Friar)
on Jan 08, 2004 at 09:53 UTC ( #319768=note: print w/ replies, xml ) Need Help??


in reply to Regex to add space after punctuation sign

I'm not quite sure got this right but heres my try (both dot and comma is used).

s/(?<=\D)([,.]) *(?=\D)/$1 /g;
Tested with this.
perl -e '$a="1,23, 23, df,sd.asf,\"\"";$a=~s/(?<=\D)([,.]) *(?=\D)/$1 +/g;print "$a\n";' 1,23, 23, df, sd. asf, ""


Comment on Re: Regex to add space after punctuation sign
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-12-26 12:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls