mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 08:04:20 +00:00
Add $ operator
This commit is contained in:
@@ -104,6 +104,7 @@ is inclusive.
|
||||
`(captureBounds|captures).toTable` :: returns a table with each named capture
|
||||
as a key.
|
||||
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
|
||||
`$: string` :: same as `match`
|
||||
|
||||
=== 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] =
|
||||
accumulateResult(pattern.items(default))
|
||||
|
||||
proc `$`*(pattern: RegexMatch): string =
|
||||
return pattern.captures[-1]
|
||||
# }}}
|
||||
|
||||
# Creation & Destruction {{{
|
||||
|
||||
Reference in New Issue
Block a user