String Manipulation

Is there be an efficient way of utilizing string patterns to convert the string
<100> Gold to <500> Gold

You could do this:

string.gsub("<100> Gold", "%d", "500")

It partially worked lol.

print(string.gsub("<100> Gold", "%d", "500"))

Here is the results from my output:
<500500500> Gold 3

I would use this:
str:gsub("%<%d+%>", "<500>")

%d+ is regex for match one or more number.
%d means a single number (0-9)
+ means one or more occurrence.

2 Likes
string.gsub("<100> Gold", "1", "5")

What @steven4547466 did

1 Like