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

can't search with unicode regular expression #39404

Closed
feichao opened this issue Dec 1, 2017 · 8 comments
Closed

can't search with unicode regular expression #39404

feichao opened this issue Dec 1, 2017 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded

Comments

@feichao
Copy link

feichao commented Dec 1, 2017

can't search with unicode regular expression

  • VSCode Version: 1.18.1 (1.18.1)
  • OS Version: macOS 10.12.6

Steps to Reproduce:

  1. input a unicode regular expression, e.g. [\u4e00-\u9fa5]
  2. some error occur
    error

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the search Search widget and operation issues label Dec 1, 2017
@roblourens
Copy link
Member

I think you need to use [\x{4e00}-\x{9fa5}]. Does that work how you expect?

@roblourens roblourens added the info-needed Issue requires more information from poster label Dec 1, 2017
@feichao
Copy link
Author

feichao commented Dec 2, 2017

Thanks a lot. But it doesn't work... Actually I want to search all the Chinese in my project.

image

@roblourens roblourens added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels Dec 2, 2017
@adelphes
Copy link

adelphes commented Dec 2, 2017

You can't use unicode escape character ranges because VSCode search uses two incompatible regex engines - one search engine uses the JavaScript regular expression syntax (albeit without the 'u' unicode flag), the other is based on ripgrep which uses Rust regular expression syntax.

If you use the Rust syntax: [\x{4e00}-\x{9fa5}] the JS RegExp parses this as a range between } and x - this is an invalid range because x < {.
If you use the JS syntax [\u4e00-\u9fa5] ripGrep cannot recognise the \uXXXX escape.

Since JS RegExp doesn't support the \x{XXXX} syntax and Rust doesn't support \uXXXX syntax, the
end result is one of the engines will always error.

@roblourens
Copy link
Member

Correct - I filed an issue upstream. vscode could also rewrite the \u patterns to \x for ripgrep.

@skyfore
Copy link

skyfore commented Apr 9, 2018

@roblourens Well, Is there any way to slove the problem ?

@roblourens
Copy link
Member

There is activity on the upstream issue but it's not pulled into vscode yet.

@AaronWing
Copy link

oh no Chinese no way

@roblourens
Copy link
Member

This was fixed upstream recently

@roblourens roblourens added this to the September 2018 milestone Sep 13, 2018
@jrieken jrieken added the verified Verification succeeded label Sep 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants