New line upsets repeat Regular Expression search

General questions about using TextPad

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

Post Reply
NellyBean

New line upsets repeat Regular Expression search

Post by NellyBean »

I am attempting to find matching start and end tags (could be HTML).

Here are some (made up) examples of start and end tags:

<fred>
</fred>
<james>
</james>

When I put in the "Find what" expression:
<\([^>]+\)>\n</\1
TextPad responds with the message "Invalid regular expression"

This is most annoying - if I move my end tag so that it is on the same line, like this:

<fred> </fred>

then the "Find what" expression:
<\([^>]+\)> </\1
works perfectly, highlighting the whole line.

And if I use the "Find what" expression
<james>\n</james>
then Textpad finds the two james lines.

So the repeat expression (the \1) works if I don't have a new line (\n) in the regular expression, and the new line works if I don't have a repeat expression. But having both in one expression causes problems.

Is this a bug, or is my regular expression really invalid?
Post Reply