(bug) search error: tagged expr. and '\n' in search text

General questions about using TextPad

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

Post Reply
sosimple
Posts: 30
Joined: Sat May 16, 2009 6:54 am

(bug) search error: tagged expr. and '\n' in search text

Post by sosimple »

If I compose a multi-line search with a "tagged expression", and a reference to the "tagged expression" within the search text (on a different line), the search fails with an error: "Invalid regular expression"

A simple example...
Document text:

Code: Select all

..Some text here...
abc
abcdef
ghighi
jkl
more text here...
Search text:

Code: Select all

Find what: ^(.+)\n\1(.+)
[x] Regular expression
And:

Code: Select all

[x] POSIX regular expression syntax
This should find:

Code: Select all

"abc
abcdef"
But, when I click "Find Next", I get an error alert:
"Invalid regular expression"

If the reference to the "tagged expression" is on the same line as the "tagged expression", then it works fine ...

Search text:

Code: Select all

Find what: ^(.+)\1\n(.+)
[x] Regular expression
Successfully finds:

Code: Select all

ghighi
jkl
I have not found this issue in the general forum, or in the "Known Problems" section.

Kevin
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

The search phrase back-reference matches several postings. For example:
The way TextPad's regex recogniser handles newlines is very weak. It doesn't allow a \n to be quantified with * or + or {m,n}, or to be contained in a parenthesised expression. And (the one relevant to your example) it doesn't allow a back-reference to refer back over a newline.
Post Reply