examples/keyval2.nim: the indices of the elements of a sequence are numbered starting with zero

This commit is contained in:
Keita Haga
2011-08-02 16:59:23 +09:00
parent f0145ba7c5
commit 74947d0185
3 changed files with 4 additions and 4 deletions

View File

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

View File

@@ -3,5 +3,5 @@ import pegs
for x in lines("myfile.txt"):
if x =~ peg"{\ident} \s* '=' \s* {.*}":
echo "Key: ", matches[1],
" Value: ", matches[2]
echo "Key: ", matches[0],
" Value: ", matches[1]

View File

@@ -6,6 +6,6 @@ asdflksadlfasf
adsfljksadfl
key=/usr/bin/value
key=/usr/bin/value
key2=/ha/ha