R

TestRegex

Contents in capture group `foo`

\g<foo>

This will return a string with the contents from the capture group named `foo`. Any name can be used as long as it is defined in the regex. If the J-flag is specified, content will be taken from the first capture group with the same name.

Examples

PCRE PYTHON

Share & Embed

Use this snippet to display this token on your own site.

<!-- Embed Regex Token: \g<foo> -->
<code class="regex-token">\g<foo></code> - Contents in capture group `foo`
<small><a href="https://testregex.com/cheatsheet/contents-in-capture-group-foo-slash-gfoo">See details</a></small>