summary refs log blame commit diff stats
path: root/examples/keyval2.nim
blob: 5e7d0ea4a2d6383fd8765f7cdd3fff84bb93e766 (plain) (tree)
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[1], 
         " Value: ", matches[2]