I found some interesting possibility in many regex engines:
It's possible to place backreference inside the capture group and reference this group.
For example: (\1)
My question: for what regex patterns it may be used? I can't imagine...
I found some interesting possibility in many regex engines:
It's possible to place backreference inside the capture group and reference this group.
For example: (\1)
My question: for what regex patterns it may be used? I can't imagine...
Consider this sample:
[something] some text [something]
You can use backreferences this way:
(\[something\])(.*?)\1
There is an explanation for use of nested references, which I think clearly demonstrates the marginal usefulness of this feature.
How about this (ignore the whitespace):
{ .* ( { .* \1 .* } ) .* }
to match the body of a method in C#/Java/...