Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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.

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2015-11-27 06:08 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (719 votes), past polls