TextPad regexp only allows nine back references

General questions about using TextPad

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

Post Reply
APC
Posts: 2
Joined: Wed Nov 24, 2004 5:27 pm

TextPad regexp only allows nine back references

Post by APC »

I have been trying to use RegExp to extract a simpler line of code out of a more complicated one.

Using the RegExp Coach to test my pattern matching this line successfully formats my code using the second, fourteenth, seventeeth and fifth groups match.

Code: Select all

ERROR.LOG(\2, \14, \17, \5);
which should do something like this:

Code: Select all

ERROR.LOG('APC', 'MAIN', 'Some Text', 'E');
However, when I copied the pattern into the TextPad replace field I got this:

Code: Select all

ERROR.LOG('APC',  4,  7, 'E');
In other words it treating the second and third elements as back reference \1 plus a literal (as it happens, \1 was spaces).

So, does TextPad have this limit on the number of back references or is there some workaround?

Cheers, APC
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Post by Drxenos »

Why do you need more than nine? You are only referencing four in your example. Can you rewrite your expression without all the extra paratheses?
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

You did not show the Regex you use and you did not show what you want to match.
Thus it is impossible to tell you whether there might be a workaround for the limit of 9 tagged expressions in Textpad.
APC
Posts: 2
Joined: Wed Nov 24, 2004 5:27 pm

Post by APC »

Drxenos wrote:Why do you need more than nine? You are only referencing four in your example.
Because the source string contains lots of parameters, and I only wanted a subset of them.
Can you rewrite your expression without all the extra paratheses?
Yes but it took more than one pass to pick up everything.

Thanks anyway.

Cheers, APC
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

APC wrote:Because the source string contains lots of parameters, and I only wanted a subset of them.
But for the other parameters, do you need () for other reasons than back-referencing?
If not, remove them.
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Post by Drxenos »

APC wrote:Because the source string contains lots of parameters, and I only wanted a subset of them.
I sorry, but I don't understand the correlation between "a lot of parameters" and the need for many paranthetical expressions.
charles
Posts: 20
Joined: Mon Dec 27, 2004 5:11 pm
Contact:

Regexp

Post by charles »

More expressions to match than nine in one run I presume.
For comma/tab delimited files, I found the same problem, i.e. nine matches being insufficient ...
Post Reply