I’m currently trying to implement a Non-Capturing Group to my pattern, but the method returns zero results when testing it with a string. Here is the code I’m using to test the pattern.
local str = "a;s;d;f;g;hjsfewe d w;;dawf4"
local pattern = "[^;]*(?:;?)"
for v in string.gmatch(str, pattern) do print(v) end
I am trying to make it match all characters up until a ;
character and remove that same character from the match. I don’t want to do any post-modifications such as :gsub()
, I want to accomplish this with non-capturing groups if possible.
Is there a way I can implement non-capturing groups in my patterns?