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

for x in lines("myfile.txt"):
  if x =~ peg"{\ident} \s* '=' \s* {.*}":
    echo "Key: ", matches[0],
         " Value: ", matches[1]