How can I find a word surrounded by $s?

The title is self explanatory. I want to find a word, or really anything, surrounded by dollar signs. For example:
$asd342$#!@#%grsf$
I would get the text asd342$#!@#%grsf$.

Are you talking about with strings?

Yes, I am. I probably should’ve mentioned that lol.

Here is a basic matching pattern:

local input = "$asd342$#!@#%grsf"
local pattern = "%$(.-)%$"

for word in string.gmatch(input, pattern) do
  print(word) -- prints asd342
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.