summary refs log tree commit diff stats
path: root/examples/extract_keyval_pairs_re.nim
blob: a594c0fa8cc1c318f4b2e3f79832ae9ce804a761 (plain) (blame)
1
2
3
4
5
6
7
8
# Filter key=value pairs from "myfile.txt"
import re

for x in lines("myfile.txt"):
  if x =~ re"(\w+)=(.*)":
    echo "Key: ", matches[0], " Value: ", matches[1]