600 expressions

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
chrisjj
Posts: 149
Joined: Sat Jan 21, 2006 10:32 pm

600 expressions

Post by chrisjj »

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.
Last edited by chrisjj on Mon Feb 18, 2008 11:04 pm, edited 1 time in total.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

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?
chrisjj
Posts: 149
Joined: Sat Jan 21, 2006 10:32 pm

Post by chrisjj »

> How are you going to apply the corresponding replacements correctly?

Put the 600 lines the "Replace with:"?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

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:
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
Of course, you'll need to use TextPad to create your regular and replacement expressions...
chrisjj
Posts: 149
Joined: Sat Jan 21, 2006 10:32 pm

Post by chrisjj »

> 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?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

chrisjj wrote:Why is TextPad needed?
I wouldn't like to construct a regular expression and replacement expression like those I suggested above with 600 elements in each without a decent editor.
chrisjj
Posts: 149
Joined: Sat Jan 21, 2006 10:32 pm

Post by chrisjj »

I have a decent editor (not TextPad), thanks.

Can anyone suggest an alternative to WE that will directly accept 600 regexp-replacement pairs? Thanks.
agnul
Posts: 21
Joined: Tue Feb 10, 2004 9:42 am
Location: Italy

Post by agnul »

chrisjj
Posts: 149
Joined: Sat Jan 21, 2006 10:32 pm

Post by chrisjj »

Ho ho ;)
Post Reply