Open remear opened 7 years ago
First, I think it currently is not possible to use Regexp options as the constructor expects them as second parameter and we just supply the pattern
value as first parameter.
The spec says, patterns must adhere to the ECMA 262 regular expression dialect. If I understand that right, then the flags are not part of the pattern (also suggested by the spec of the constructor). If I am right, then unfortunately the spec does not permit Regexp options at all.
I've encountered a case where I need to use some regex options in a pattern. Is there a way to specify them in the schema as pattern and have them work with https://github.com/ruby-json-schema/json-schema/blob/master/lib/json-schema/attributes/pattern.rb#L10?
Currently, if you specify a pattern like
/--foo--(.*)--bar--/m/
, it becomes/\/--foo--(.*)--bar--\/s\//
, which doesn't match as expected.