Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

matching a certain # of digits within a string?

Asked by 8 years ago

I've glanced at the wiki page for a way to do this. Now I know you'd use the operator "%d+" in the "string.match" function, but how would you check for a certain number of digits instead of all the digits?

0
You can use multiple of the same character class (e.g. 3 digits would be "%d%d%d"), however I do not know of a shortcut BlackJPI 2658 — 8y
0
Couldn't you use string.sub? For example, X = "Happy" print(string.sub(x,1,1)) will print the first letter. I'm not quite sure what you were asking though so I probably didn't help xD Good luck though! User#11440 120 — 8y
3
Be more specific. What is the exact problem you want to solve? Give several examples of input and output showing both failure and success. BlueTaslem 18071 — 8y
0
^^^ Yes. I am also confused on what your attempting to do. koolkid8099 705 — 8y
0
To be a little more specifc, there aren't any other --QUANTIFIERS-- that specify a certain # of that specific class (e.x. "%d" specifies only one digit, but instead of doing "%d+", how could you specifiy a certain # of those digits?) LateralLace 297 — 8y

Answer this question