RosettaCodeData/Task/Strip-comments-from-a-string/Lua/strip-comments-from-a-string.lua

8 lines
211 B
Lua
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
comment_symbols = ";#"
s1 = "apples, pears # and bananas"
s2 = "apples, pears ; and bananas"
print ( string.match( s1, "[^"..comment_symbols.."]+" ) )
print ( string.match( s2, "[^"..comment_symbols.."]+" ) )