perl.beginners
[Top] [All Lists]

Regex help

Subject: Regex help
From: Beginner
Date: Mon, 03 Sep 2007 15:53:47 +0100
Newsgroups: perl.beginners

Hi,

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?
Dp.


<Prev in Thread] Current Thread [Next in Thread>