vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

Invalid regex using pattern for case insensitivity "(?i)"

Open erwinkramer opened this issue 2 years ago • 1 comments

Describe the bug

Using a pattern like "pattern": "(?i)(SecurityGroup)", wil break all validation in the same scheme,

Expected Behavior

Should work, same scheme works just fine for json documents with the build-in extension in vscode. Also validates fine with regex engines i tried.

Current Behavior

With error: Message: Request textDocument/hover failed with message: Invalid regular expression: /(?i)(Dynamic|Static)/: Invalid group

Steps to Reproduce

Use any pattern beginning with (?i) in your scheme.

Environment

  • Windows

erwinkramer avatar Aug 10 '23 08:08 erwinkramer

I can reproduce this issue and it seems to affect all inline regex modifiers. This is probably because JavaScript/ECMA 262 is used as the parser resulting in a unparsable regex. It does not support this particilar syntax (but should support /string/i). Depending on the JSON Schema implementation, the example you provided is a valid regex or not (PHP parses it correctly).

rsegers avatar Aug 10 '23 15:08 rsegers