Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ONIGMO regex question...

Nov
27
1
How can I use backreference less than 1 followed by a numeric character?? Suppose the regex is to insert 0 between a word and a dec number, for instance I'd replace bk391 to become bk0391. So set t=bk391 and command is
echo %@rereplace[^([a-z]+)(\d+),\10\2,%t]
will give ERROR instead of giving bk0391 as engine think I refer to a non-existent group of 10th captured group instead of the1st..
Please help me...many thankfulness in advance
 
Enclose the back-reference number in curly brackets:
%@rereplace[^([a-z]+)(\d+),\{1}0\2,bk391]
or quote the zero with a caret:
%@rereplace[^([a-z]+)(\d+),\1^0\2,bk391]
 
Back
Top