Handbook
Glossary
first-match-with-captures ( string regexp -- match/f )
Regular expressions
ยป
Regular expression capture groups
Next:
all-matches-with-captures ( string regexp -- matches )
Vocabulary
regexp
Inputs
string
a
string
regexp
a
regexp
Outputs
match/f
a
regexp-match
or
f
Word description
Returns captures for the same whole match as
first-match
, or
f
if no match exists. Capture selection is described in
Regular expression capture groups
.
Errors
Throws
duplicate-capture-name
when compiling captures for an expression with duplicate names.
Definition
USING:
kernel
regexp.captures
regexp.private
sequences
;
IN:
regexp
::
first-match-with-captures
( string regexp -- match/f )
regexp
ensure-capture-code
:>
code string regexp
first-match
[
>slice<
code
captures-at
]
[
f
]
if*
;