Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns with case insensitive #4

Open
gdufloux opened this issue Apr 27, 2011 · 0 comments
Open

Patterns with case insensitive #4

gdufloux opened this issue Apr 27, 2011 · 0 comments

Comments

@gdufloux
Copy link

Hi, dear validation addicts

I recently had an issue when trying to validate a string against a pattern case insensitive.
Indeed, the regexp is currently built as following:

# https://github.com/Constellation/ruby-jsonchema/blob/master/lib/jsonschema.rb#L120
Regexp.new(schema['pattern'])

As a result, pattern options are lost when extracting the source only:

r = /cat/ix
schema['pattern'] = r.source
Regexp.new(schema['pattern'])
# => /cat/

Would be great to have the possibility to pass pattern options too:

r = /cat/ix
schema['pattern'] = r.source
schema['pattern'] = r.options
Regexp.new(schema['pattern'],schema['pattern_options']) 
# => /cat/ix

Best regards,
Guillaume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant