I’m receiving this error (I’m using C#):
parsing “(–[[.?]])|(–[[.)” – Unterminated [] set.
When trying to add Lua’s multiple comment code. Here is what it should be:
--[[
Hello
]]
However, when I take out the ‘]]’ at the end of this Regex:
(--[[.*?]])|(--[[.*)
it will give me this error. However, if I add the ‘]]’ in the above, example:
(--[[.*?]])|(--[[.*]])
it works perfectly fine.
Here is the full code:
Regex CustomCommentRegex1, CustomCommentRegex2, CustomCommentRegex3;
CustomCommentRegex1 = new Regex(@"--.*$", RegexOptions.Multiline | RegexCompiledOption);
CustomCommentRegex2 = new Regex(@"(--[[.*?]])|(--[[.*)", RegexOptions.Singleline | RegexCompiledOption);
CustomCommentRegex3 = new Regex(@"(--[[.*?]])|(.*]])", RegexOptions.Singleline | RegexOptions.RightToLeft | RegexCompiledOption);
‘CustomCommentRegex2’ is where I get this ‘Unterminated [] set’ error. I have an issue if I add the ‘]]’ at the end of ‘CustomCommentRegex2’. It will highlight the text above ‘–[[ ]]’ the comments and inside of it; anyway, the issue is this ‘Unterminated [] set’ error.
From the Regex website
Escape the brackets with a \