String Pattern Help

This kinda works too but it replaces the character before the period aswell. So “foo.” becomes “foHey” instead of “fooHey”.
It also doesn’t work if there is just a period by itself

You could keep adding more negative look(aheads/behinds)

I’m currently to tired to do a bunch :sob:

1 Like

try this

local inputString = "This is a test string. It contains a dot. It also contains a %.dot."
local pattern = "(?<!%%)%."

local result = inputString:gsub(pattern, ",")

print(result)

output

This is a test string, It contains a dot, It also contains a %.dot.

1 Like

I just tested this and it didn’t work