string - Lua: RegEx to Pattern -
simple problem...i need turn regex pattern...
"\[\"([0-9]+)\"\]"
into lua pattern.
i doing replace bunch ["x"] lines [x] in string x number -∞ or +∞...so that's limitation. need port lua patterns can use in string.gsub.
find: "\[\"([0-9]+)\"\]"
also, how remove " " around number? need pattern that. if me out, appreciate it.
you try this.
> f = "foo [\"12\"] bar" > x = string.gsub(f, "%[\"(%d+)\"%]", "[%1]") > print(f) foo ["12"] bar > print(x) foo [12] bar
\d
matches digits represented %d
in lua.
Comments
Post a Comment