Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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?

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: (10)
As of 2016-10-24 15:00 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (307 votes). Check out past polls.