RegEx: Using backreference in match
am 26.10.2004 17:44:35 von Thorsten Walenzyk
Hi all,
I have a question regarding Regular Expression and backreference.
Is it possible to use backreferences within the same reg ex?
e.g.
m/SomeText([0-9]+).*?SomeOtherText($1)/gs
$1 should be the number of the match behind "SomeText"
BR Thorsten
Re: RegEx: Using backreference in match
am 27.10.2004 00:37:40 von someone
Thorsten Walenzyk wrote:
>
> I have a question regarding Regular Expression and backreference.
>
> Is it possible to use backreferences within the same reg ex?
> e.g.
> m/SomeText([0-9]+).*?SomeOtherText($1)/gs
>
> $1 should be the number of the match behind "SomeText"
Yes it is possible, like this:
/SomeText(\d+).*?SomeOtherText\1/gs
John
--
use Perl;
program
fulfillment