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

regexp: does not recognize non-ascii character #21332

Closed
dongweigogo opened this issue Aug 7, 2017 · 3 comments
Closed

regexp: does not recognize non-ascii character #21332

dongweigogo opened this issue Aug 7, 2017 · 3 comments

Comments

@dongweigogo
Copy link

go 1.8

I need a pattern to only match characters and underlines:
var re=regexp.MustCompile([\w_]*)
however, it also return true for "A_人123" which contains a non-ascii character. Is there any fix for this?

@nussjustin
Copy link
Contributor

You can use ^ and $ in your pattern to match the whole input. Example

Please use golang-nuts or stack overflow for these kind of questions in the future.

@dongweigogo
Copy link
Author

@nussjustin OK, I'll switch to golang-nuts for this

@dsnet
Copy link
Member

dsnet commented Aug 7, 2017

Closing this as the issue tracker is intended for bug reports and feature requests. Go nuts is the right place for this. Thanks.

@dsnet dsnet closed this as completed Aug 7, 2017
@mikioh mikioh changed the title regexp does not recognize non-ascii character regexp: does not recognize non-ascii character Aug 7, 2017
@golang golang locked and limited conversation to collaborators Aug 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants