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

How do I get matches to ignore case #197

Closed
wangfenggao opened this issue Feb 20, 2019 · 3 comments
Closed

How do I get matches to ignore case #197

wangfenggao opened this issue Feb 20, 2019 · 3 comments

Comments

@wangfenggao
Copy link

wangfenggao commented Feb 20, 2019

RE2 re("hello");
RE2::FullMatch(“Hello”, re)
How do I get matches to ignore case

@junyer
Copy link
Contributor

junyer commented Feb 21, 2019

You can use (?i) in the pattern (https://github.com/google/re2/blob/master/re2/re2.h#L30) or unset case_sensitive in the options (https://github.com/google/re2/blob/master/re2/re2.h#L561-L562).

@junyer junyer closed this as completed Feb 21, 2019
@wangfenggao
Copy link
Author

wangfenggao commented Feb 21, 2019

thanks for your answer, and If I do it the second way, is it reasonable to do so:
RE2::Options options;
options.set_case_sensitive(false);
RE2(pattern, options);

@junyer
Copy link
Contributor

junyer commented Feb 21, 2019

Yes, that's right. (Although the third line of code is missing the variable name.)

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

2 participants