Skip to content

Underscore will not match propblaly #1200

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

Closed
dbergloev opened this issue Jun 5, 2024 · 2 comments
Closed

Underscore will not match propblaly #1200

dbergloev opened this issue Jun 5, 2024 · 2 comments

Comments

@dbergloev
Copy link

Hi.

I tried making a simple regexp r"^[^\s\\/]+$" but for some reason this would not allow underscore when testing with is_match(). I tried changing the above to something like r"^[A-Za-z0-9\.-_]+$" just to test if this was somehow captured with \s for some reason, but I get the same result, is_match() returns false if the string contains any underscore characters.

For now the only solution that I came up with was to only test dashes using a temp testing string: let mystr_chk = mystr.replace("_", "-"). Since both are valid for my test and I don't need to know explicitly which ones are used, this works for this particular use case. But I thought still to report this for future fixes.

@dbergloev
Copy link
Author

Damn, to fast on this. For some reason doing a cargo clean fixed this problem. Not sure what caused it, but it seams to be working now.

@BurntSushi
Copy link
Member

Odd. Also, in the future, definitely provide a complete Rust program demonstrating the issue. But I'm glad it's resolved.

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