anglee
anglee

Reputation: 99

Extract number from the end of a string

I have strings with pattern "ab234cafsd5464". I need to extract last part of the string which is a number. How do we do this in Lua?

Upvotes: 1

Views: 197

Answers (1)

user142162
user142162

Reputation:

Perform an anchored match from the end of the string of one or more digits:

string.match("ab234cafsd5464", "%d+$")

Upvotes: 2

Related Questions