I have 600 one-line regexps and corresponding replacementpatterns which I need to apply to about 100 files. How to I do this? I seem unable to get Replace to recognise the 600 lines as separate expressions.
Thanks.
600 expressions
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
600 expressions
Last edited by chrisjj on Mon Feb 18, 2008 11:04 pm, edited 1 time in total.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
I presume you selected the option Syntax options: Newline separates alternatives.
Try selecting the option Literal line break characters: Linefeed only (Unix), too.
Or you can separate the alternatives with a | on a single line.
How are you going to apply the corresponding replacements correctly? By using conditional expressions?
Try selecting the option Literal line break characters: Linefeed only (Unix), too.
Or you can separate the alternatives with a | on a single line.
How are you going to apply the corresponding replacements correctly? By using conditional expressions?
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
What do you mean by corresponding? Do you mean that if the first regular expression matches then the first replacement expression should be used, and so on? If so, you can't just put the replacement expressions on separate lines. What you need is conditional expressions. For example:
Of course, you'll need to use TextPad to create your regular and replacement expressions...Find what: (a)|(b)|(c)|(d)|(e)|(f)|(g)|(h)|(i)|(j)|(k)|(l)|(m)|(n)|(o)|(p)|(q)|(r)|(s)|(t)|(u)|(v)|(w)|(x)|(y)|(z)
Replace with: ?1(Alpha ):?2(Bravo ):?3(Charlie ):?4(Delta ):?5(Echo ):?6(Foxtrot ):?7(Golf ):?8(Hotel ):?9(India ):?10(Juliet ):?11(Kilo ):?12(Lima ):?13(Mike ):?14(November ):?15(Oscar ):?16(Papa ):?17(Quebec ):?18(Romeo ):?19(Sierra ):?20(Tango ):?21(Uniform ):?22(Victor ):?23(Whisky ):?24(X-ray ):?25(Yankee ):?26(Zulu )
[X] Regular expression
[X] Replacement format
> Do you mean that if the first regular expression matches
> then the first replacement expression should be used, and so on?
Yup.
> What you need is conditional expressions.
Oh dear!
> Of course, you'll need to use TextPad to create
> your regular and replacement expressions...
Why is TextPad needed?
> then the first replacement expression should be used, and so on?
Yup.
> What you need is conditional expressions.
Oh dear!
> Of course, you'll need to use TextPad to create
> your regular and replacement expressions...
Why is TextPad needed?
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm