Add $ operator
This commit is contained in:
parent
f141737b9f
commit
2598909ffd
2 changed files with 4 additions and 0 deletions
|
|
@ -104,6 +104,7 @@ is inclusive.
|
||||||
`(captureBounds|captures).toTable` :: returns a table with each named capture
|
`(captureBounds|captures).toTable` :: returns a table with each named capture
|
||||||
as a key.
|
as a key.
|
||||||
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
|
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
|
||||||
|
`$: string` :: same as `match`
|
||||||
|
|
||||||
=== Pattern
|
=== Pattern
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@ proc toSeq*(pattern: CaptureBounds, default = None[Slice[int]]()): seq[Option[Sl
|
||||||
|
|
||||||
proc toSeq*(pattern: Captures, default: string = nil): seq[string] =
|
proc toSeq*(pattern: Captures, default: string = nil): seq[string] =
|
||||||
accumulateResult(pattern.items(default))
|
accumulateResult(pattern.items(default))
|
||||||
|
|
||||||
|
proc `$`*(pattern: RegexMatch): string =
|
||||||
|
return pattern.captures[-1]
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Creation & Destruction {{{
|
# Creation & Destruction {{{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue