RosettaCodeData/Task/Regular-expressions/Nim/regular-expressions.nim

10 lines
141 B
Nim
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
import re
var s = "This is a string"
if s.find(re"string$") > -1:
echo "Ends with string."
s = s.replace(re"\ a\ ", " another ")
echo s