September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,10 +0,0 @@
require"re"
record = re.compile[[
record <- ( <field> (',' <field>)* ) -> {} (%nl / !.)
field <- <escaped> / <nonescaped>
nonescaped <- { [^,"%nl]* }
escaped <- '"' {~ ([^"] / '""' -> '"')* ~} '"'
]]
print(unpack(record:match"hello,how,are,you,today"))

View file

@ -1,10 +0,0 @@
str = "Hello,How,Are,You,Today"
tokens = {}
for w in string.gmatch( str, "(%a+)" ) do
tokens[#tokens+1] = w
end
for i = 1, #tokens do
print( tokens[i] )
end

View file

@ -1,11 +0,0 @@
str = "Hello|How|Are|You||Today"
tokens = {}
for w in string.gmatch( str, "([^|]*)|?" ) do
tokens[#tokens+1] = w
end
table.remove(tokens)--pops off the last empty value, because without doing |? we lose the last element.
for i = 1, #tokens do
print( tokens[i] )
end