SE-0354 (Second Review): Regex Literals

Yes. I think it would because it matches all four of these conditions:

The least intrusive fix is probably to put parentheses around the first expression:

someFunction((/MyEnum.case1), /MyEnum.case2)

This causes the potential regex literal to fail the "unbalanced )" condition, thus causing it not to be parsed as a regex.

Another choice would be to split the arguments across multiple lines, to make it fail the "closing / on the same line" condition:

someFunction(
    /MyEnum.case1,
    /MyEnum.case2
)
1 Like