tags:

views:

98

answers:

1

Because I have lines like

space space **da ta** tab tab **data**
tab **data** tab tab tab tab **da ta**

I want the above to turn into

**da ta**,**data**
**data**,**da ta**

I need regex to remove all the white space before the first letter and replace the rest with commas... but still ignoring the white space in between the letters in the data

+1  A: 
s/^[ \t]+//;  # remove leading whitespace (just once)
s/[ \t]+/,/g; # replace all runs of spaces into commas globally
PP
+1 although I would use \s+.
Anton
That would work except sometimes the data has spaces in it..
DerNalia
What I ended up doing was removing all instances of a double space repeatedly... works well. I did use some of that though
DerNalia