How do I extract all numbers from a string?

I’ve seen a post about this, but not exactly what I wanted.

I’m trying to remove all numbers from a certain string. Here’s what I’d like:

before conversion:

noah3393944

after:

noah

What’s the best way to do this?

Thanks,
the scripting noob, alessdai

2 Likes

Use string.gsub:

string.gsub("noah3393944", "%d+", "")

This will remove all occurrences of digits and replace them with empty string

17 Likes