General questions about using TextPad
Moderators: AmigoJack , bbadmin , helios , Bob Hansen , MudGuard
Thomas Schremser
Post
by Thomas Schremser » Tue Oct 24, 2006 8:55 am
Hi everybody!
I've got files which contain text like
where * stands for an arbitrary character. There are certain occurences of this text at which the left character is the same as the right one. These occurences are easily found with (using POSIX)
My problem is that I want to find occurences where the characters are different. I've tried
which doesn't find anything and
which finds all occurences regardless if the characters are different or the same. Does anybody have an idea how to resolve this?
TIA
meisn
Posts: 11 Joined: Wed Oct 18, 2006 6:25 pm
Location: Germany
Contact:
Post
by meisn » Tue Oct 24, 2006 11:03 am
Hi Thomas,
have you tried the same procedure with wild edit?
(.) ON \1
will work with it.
The thing is, if I understand this correctly, that the POSIX Syntax (or NFAs in general) doesn't support back-references in the search string. Maybe this is related to the backtracking mechanism of the engine.
Please give it a try with the WildEdit program.
Regards,
Meisn
meisn
Posts: 11 Joined: Wed Oct 18, 2006 6:25 pm
Location: Germany
Contact:
Post
by meisn » Tue Oct 24, 2006 5:29 pm
Hi,
sorry Thomas but there was a slightly misunderstanding when I had posted my first answer.
My suggestion will only find preceding or equal matches like A ON A etc.
Your question was to find the opposite which is more difficult to do.
I will try to think about it and will post my results (if I will find something
)
Sorry again
Meisn
meisn
Posts: 11 Joined: Wed Oct 18, 2006 6:25 pm
Location: Germany
Contact:
Post
by meisn » Tue Oct 24, 2006 5:44 pm
Hello Thomas,
I've tried to find something out and this solution works with the WildEdit:
(.) ON (?!\1)[A-Z]+
It uses the Negative Lookahead to prevent the regex from matching equal characters and catch the character afterwards.
This is:
1. (.) any charcter
2. (?!\1) the negative lookaround, which points to the non-equal charcter
3. [A-Z]+ any character which occurs one or more times
I had tried it on this little example, the green marked lines are matches:
A ON A
B ON B
B ON C
A ON C
A ON A
Please let me know if this solves your problem.
Thomas Schremser
Post
by Thomas Schremser » Wed Oct 25, 2006 6:25 am
Hi meisn!
meisn wrote:
I've tried to find something out and this solution works with the WildEdit:
(.) ON (?!\1)[A-Z]+
Thank you very much. This is exactly what I was looking for.
ben_josephs
Posts: 2461 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Sat Oct 28, 2006 5:34 pm
meisn wrote: (.) ON (?!\1)[A-Z]+
Or just
(.) ON (?!\1).