Page 1 of 1

[Fixed]advanced replacement

Posted: Tue Sep 16, 2008 2:55 am
by bestycame
Hi All,
i'm having some trouble to find how i could instruct Textpad to make a couple of replacements in a file that i have got.
for the moment, i have a big file (180 000 lines) that is actually a list of tags followed by some information.

it looks like this

Code: Select all

NAME Bestycame
ID 32553
HO1 abcdef' MNOPQ xy QWERTY
and what i would like to do is to replace every line that begin by 'HOP' then a couple of lowercase (and sometimes the caracter ' and a space eg: ab; ab'; ab cd) to be splitted into two lines, one with a new tag and the first set of lowercase, and the second one with the old tag and the rest of the data.

to have something that looks like this instead:

Code: Select all

NAME Bestycame
ID 32553
HO0 abcdef'
HO1 MNOPQ xy QWERTY
any idea how i could do that?
thanks a lot!

Posted: Tue Sep 16, 2008 11:21 am
by ben_josephs
Replace each underscore with a space in:

Find what: ^(HO[0-9])_([a-z'_]+)_(.*)
Replace with: HO0_\2\n\1_\3

[X] Match case
[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Tue Sep 16, 2008 10:50 pm
by bestycame
Oh man! it works that's great!
thanks a million for your help!

damn, Textpad is so powerfull!