[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[StrongED] Re: Regular Search and Replace on a key?



In article <b10557e150.wra1th@xxxxxxxxxxxxxxx>, Gavin Wraith
<gavin@xxxxxxxxxxxxxxx> wrote:
> In message <50e1531249barry@xxxxxxxxxxxxx> you wrote:

> > I regularly wish to turn a 'TAB' separated document into a Comma
> > Separated Value document. I do this by searching for a TAB (/t) and
> > replacing with a comma (",").
> >
> > Is it possible to put this search and replace on a key?

> Do you want to do this to TABs occurring inside strings as well?
> If yes, OK. Otherwise you have a bit more than a straight
> search-and-replace on your hands.
> CSV and TSV are notoriously tricky formats to get completely
> right. I can whip you up a parser expression grammar script for
> StrongED that will do the right thing, but I doubt whether I could
> do it with StrongED's built in operations.

All the TSV documents are very similar and do not contain TABs inside
strings. A straight forward replace of TABs with commas always works
for the documents I have. 

All the TSV documents are similar to the extract below:-

Sat 05th Sep 2009{TAB}West Park 2{TAB}Wilmslow 2{TAB}29 - 18
Sat 05th Sep 2009{TAB}Vale of Lune 2{TAB}Leigh 3{TAB}86 - 0
Sat 05th Sep 2009{TAB}Wigan 2{TAB}Blackburn 2{TAB}17 - 13
Sat 05th Sep 2009{TAB}Preston Grasshoppers 3{TAB}Fylde 3{TAB}3 - 5

Which I turn into:-

Sat 05th Sep 2009,West Park 2,Wilmslow 2,29 - 18
Sat 05th Sep 2009,Vale of Lune 2,Leigh 3,86 - 0
Sat 05th Sep 2009,Wigan 2,Blackburn 2,17 - 13
Sat 05th Sep 2009,Preston Grasshoppers 3,Fylde 3,3 - 5

-- 
Barry A.

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx