mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
13 lines
344 B
Nim
13 lines
344 B
Nim
discard """
|
|
action: "reject"
|
|
|
|
"""
|
|
|
|
import strutils, sugar, nre
|
|
|
|
proc my_replace*(s: string, r: Regex, by: string | (proc (match: string): string)): string =
|
|
nre.replace(s, r, by)
|
|
|
|
discard my_replace("abcde", re"[bcd]", match => match.to_upper) == "aBCDe"
|
|
discard my_replace("abcde", re"[bcd]", (match: string) => match.to_upper) == "aBCDe"
|