Page 1 of 1

Recursive? regular expression, or multiple search macro?

Posted: Wed Sep 30, 2009 3:52 pm
by Mike Olds
Greetings,

I would appreciate it if anyone can help me set up a regex to use in WildEdit to search out a list of terms and the terms to replace them.

The original text looks like this:

iµsampi j¤tiyo iµsampi j¤tiyo pa¾¾¤sampi j¤tiyo j¤tisatam pi j¤tisahassampi j¤tisatasahassampi anek¤ni'pi j¤tisat¤ni anek¤ni'pi j¤tisahass¤ni anek¤ni'pi

What needs to be done is:

Search for and replace one at a time: iµsampi, iµsampi, pa¾¾¤sampi, anek¤ni'pi, j¤tisat¤ni ...
Replace with: iµsam pi, iµsam pi, pa¾¾¤sam pi, anek¤ni pi, j¤ti-sat¤ni ...

Currently set up as: regular expression, match case, search subfolders
use POSIX regular expressions

I have read the help files and a few pages back in this and the WildEdit forums (not necessarily understanding them) I do not understand the logic of the 'regular expression' option and it's relationship to the 'replace format' option. I have it checked, but it does not seem to be seeing regular expressions in my input, that is, it seems to be seeing literal '.' even when not escaped. Sometimes when I input a regular expression that works in Textpad, it doesn't work in Wild Edit. Any help explaining this?

I seem to be able to use the search tool within Textpad with regular expressions without problems

Posted: Wed Sep 30, 2009 8:21 pm
by ben_josephs
You haven't described precisely what you tried that didn't work.

WildEdit's regular expressions are quite different from, and far more powerful than, TextPad's.

Do you mean you want to replace

Code: Select all

iµsampi     with  iµsam pi
pa¾¾¤sampi  with  pa¾¾¤sam pi
anek¤ni'pi  with  anek¤ni pi
j¤tisat¤ni  with  j¤ti-sat¤ni
?

You can't do that in one go in TextPad, but you can in WildEdit, using conditional expressions:
Find what: (iµsampi)|(pa¾¾¤sampi)|(anek¤ni'pi)|(j¤tisat¤ni)
Replace with: ?1iµsam pi:?2pa¾¾¤sam pi:?3¤ni pi:?4j¤ti-sat¤ni

[X] Regular expression
[X] Replacement format

Posted: Wed Sep 30, 2009 8:36 pm
by Mike Olds
Hello Ben,

Thank you for your response which quick look looks like it will do what I want. Bunch of replacements where one at a time would drive me nutz. I'm into the 100-thousands.

I think I am just not up to speed on the features, so won't trouble you here. Next example from real life.

Thank you for this solution to the current problem.

obo

success

Posted: Thu Oct 01, 2009 1:43 pm
by Mike Olds
Worked as advertised. I worked less than advertised. Did not notice the first 'l' of the numbered replacement group, so everything got changed to the first one.

Hard knocks always the best teacher.