Description Usage Arguments See Also Examples
Used to save the matched value within the group for use later in the regular
expression or to extract the values captured. Both named and unnamed groups
can later be referenced using capture_group
.
1 2 3 |
... |
|
name |
of the group. Unnamed capture groups are numbers starting at 1 in the order they appear in the regular expression. If two groups have the same name, the leftmost group is the used in any reference. |
group
for grouping without capturing. Perl 5 Capture
Groups https://perldoc.perl.org/perlre#Capture-groups
Other rex:
%or%()
,
character_class()
,
counts
,
group()
,
lookarounds
,
not()
,
rex()
,
shortcuts
,
wildcards
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Match paired quotation marks
re <- rex(
# first quotation mark
capture(quotes),
# match all non-matching quotation marks
zero_or_more(except(capture_group(1))),
# end quotation mark (matches first)
capture_group(1)
)
#named capture - don't match apples to oranges
re <- rex(
capture(name = "fruit", or("apple", "orange")),
"=",
capture_group("fruit")
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.