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

Regex#inspect does not show all flags #14530

Closed
HertzDevil opened this issue Apr 23, 2024 · 0 comments · Fixed by #14575
Closed

Regex#inspect does not show all flags #14530

HertzDevil opened this issue Apr 23, 2024 · 0 comments · Fixed by #14575

Comments

@HertzDevil
Copy link
Contributor

Regex#inspect's format is based on regex literals themselves, so it handles the flags that can be applied to literals:

Regex.new("foo", :ignore_case) # => /foo/i
Regex.new("foo", :multiline)   # => /foo/m
Regex.new("foo", :extended)    # => /foo/x

but not the other Regex::CompileOptions flags:

Regex.new("foo", :anchored)     # => /foo/
Regex.new("foo", :no_utf_check) # => /foo/

In these cases perhaps it is better to fall back to a non-literal format?

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

Successfully merging a pull request may close this issue.

1 participant