[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] Re: Regular Search and Replace on a key?
In message <50e16fc521barry@xxxxxxxxxxxxx>
Barry E Allen <barry@xxxxxxxxxxxxx> wrote:
> 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
Tying this S&R to a key is easy. Open the modes menu by clicking Adjust
on StrongED's iconbar icon. Click Shift-Select on the name of the mode
in which you want to add the keypress. In the ModeFile opened, find the
KeyList (if it's BaseMode then find the main KeyList). Pick a suitable
key combination and assign it the following:
Replace("\t",",",Text,NoLine,NoCase)
Save the file when done and the new keypress should be available.
You can find out more in the manual:
Manual -> Reference -> List of functions -> Replace
Manual -> Introduction -> Search and Replace2
Cheers,
Fred.
--
StrongED developer
http://www.stronged.iconbar.com/
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx