summary refs log tree commit diff stats
path: root/tests/misc/t16541.nim
blob: 452327e8fa3847fb9d286703a2023872fd1597dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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"