Page 1 of 1

TextPad regexp only allows nine back references

Posted: Wed Nov 24, 2004 5:38 pm
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

Posted: Wed Nov 24, 2004 6:13 pm
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?

Posted: Wed Nov 24, 2004 9:37 pm
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.

Posted: Thu Nov 25, 2004 11:00 am
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

Posted: Thu Nov 25, 2004 12:50 pm
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.

Posted: Mon Nov 29, 2004 7:19 pm
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.

Regexp

Posted: Mon Dec 27, 2004 5:26 pm
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 ...