No matching definitions.

regex/capture

src/regex/capture.tur
defn

capture-count

(capture-count [match :int] :int)

number of captured substrings in a match result.

match:int match handle from regex-match

:int -- number of captured groups (0 = only full match in group 0)

(capture-count m)  ; => 2

Since: P6

defn

capture-at

(capture-at [match :int idx :int] :cstr)

substring captured by a numbered group.

match:int match handle from regex-match
idxgroup index (0 = full match, 1 = first capture group, ...)

:cstr -- captured substring (malloc'd copy), or "" if group did not participate

(capture-at m 0)  ; full match
  (capture-at m 1)  ; first capture group

Since: P6

defn

capture-named

(capture-named [match :int name :cstr] :cstr)

substring captured by a named group.

match:int match handle from regex-match
namegroup name as it appears in the pattern (e.g. "year")

:cstr -- captured substring (malloc'd copy), or "" if not found / did not participate

(capture-named m "year")

Since: P6