Beginner wrote:
I am trying to come up with a regex to squash multiple commas into
one. The line I am working on looks like this:
SPEED OF LIGHT, , LIGHT SPEED,TRAVEL,TRAVELLING, ,
DANGER,DANGEROUS,PHYSICAL, , CONCEPT,CONCEPTS, , , , , , , , , ,
There are instances of /,\s{1,},/ and /,,/
The bit that I am struggling with is finding a way to get a use a
multiplier for the regex /,\s+/ but I have to be careful not to
remove single entries. I guess the order of my substitutions is
important here.
Can anyone offer any tips please?
Hey Dermot.
I think just
$text =~ s/,[,\s]+/,/g;
is all you need.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/