How can I get:
for w in string.gmatch(s, "%d+") do
to accept "-" ? Right now it only accepts letters and numbers.
How can I get:
for w in string.gmatch(s, "%d+") do
to accept "-" ? Right now it only accepts letters and numbers.
%d only captures digits, for alphanumeric use %w
For negative numbers (while allowing positive aswell) -?%d+
For any string of numbers and/or -'s you can do [-%d]+
This discussion is preserved as it was. New answers, comments, and votes are closed.