String pattern help

I have two questions about string patterns:

  1. How do you match a capture to the end of a string
  2. How do you match a capture of 2 or more characters

For example, the following code will return 1:

local meshValue = ""
local meshId = string.match(meshValue, "%d+")


For both methods, how can I modify the current string pattern to print 4462471942 instead?

You can use the $ anchor to force the match to the end.

local meshValue = ""
local meshId = string.match(meshValue,"%d+$")
print(meshId) --> 4462471942

As for matching 2 or more, you would have to use the same character class multiple times.

local meshValue = ""
local meshId = string.match(meshValue,"%d%d+")
print(meshId) --> 4462471942