Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Regex to add space after punctuation sign

by grinder (Bishop)
on Jan 08, 2004 at 08:42 UTC ( #319747=note: print w/replies, xml ) Need Help??


in reply to Regex to add space after punctuation sign

The best I can come up with is

#! /usr/bin/perl use strict; while( <DATA> ) { s/(?<!\d), *|, *(?=\D)/, /g; print; } __DATA__ 1,2,a,b 1,a,2,b 1,a,b,2 a,1,2,b __produces__ 1,2, a, b 1, a, 2, b 1, a, b, 2 a, 1,2, b

But the use of alternation strikes me a bit as cheating. There is no doubt ABWTDI, but I can't see it for the moment.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://319747]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2017-02-24 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (363 votes). Check out past polls.