Page 1 of 1

regular expression help

Posted: Mon Mar 27, 2006 6:30 pm
by dabombst
Hi

I need to delete from the "\" to the ";", but dont want the semicolon to be delete.

Export002\AIG 005647-AIG 005647;AIG 005647-AIG 005647.T
Export00200\AIG 005648-AIG 005648;AIG 005648-AIG 005648.T
Export0022\AIG 005649-AIG 005649;AIG 005649-AIG 005649.T

to look like this...

Export002;AIG 005647-AIG 005647.T
Export00200;AIG 005648-AIG 005648.T
Export0022;AIG 005649-AIG 005649.T

thanks

Posted: Mon Mar 27, 2006 6:59 pm
by SteveH
You need to use the following regular expression:

Find:
\\.*;
Replace with:
;
This finds instances of \ (the initial \ escape character makes this a literal backslash) followed by any character (.) repeated (*) and followed by a ;. This string is replaced with a ;

Posted: Mon Mar 27, 2006 10:47 pm
by dabombst
thanks

Posted: Mon Aug 21, 2006 12:51 pm
by Niels H. Veldhuijzen
Dear SteveH,

Are you sure this will work when there are two or more semicolons in one line? :(

Posted: Mon Aug 21, 2006 1:00 pm
by ben_josephs
If you want to delete from the first '\' to the first ';' following, use:
Find what: \\[^;]*;
Replace with: ;

[X] Regular expression