-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Multiline find in file (Ctrl+F) does not work for \s or [^] regular expressions #9051
Comments
@anseki We use JavaScript's regular expression engine behind the scene, so the supported syntax should be that of JavaScript regex. We do not have plans to switch to a different regular expression engine. |
At least, V8 in Electron seems to interpret regular expressions correctly. '<A\nB\nC>'.replace(/<[ABC\s]*>/, 'OK') '<A\nB\nC>'.replace(/<[^]*>/, 'OK') Two strings that include line breaks were replaced correctly, and I think, if regular expression of VS Code differs from JavaScript, the information should be documented. Because the pattern matches a string which doesn't include line break, we might overlook something important. |
@anseki Sorry about that! Now I understand what's going on. To optimize on memory usage we do the following:
Looks like the heuristic is wrong, as |
Sorry, my wrong English... I read that code and I thought that this issue is difficult, because it can't decide whether the pattern get multiline or not by only keyword or characters.
|
Hi @nunoarruda, Strangely enough, it seems to find files in "SEARCH" sidebar when the files are opened by editor. (of course "Find" in editor also find that.) |
@anseki I've tried what you've reported with my example and I can reproduce. It matches (but incorrectly) when the file is open but it does not match when the file is closed. The regex find in VS Code is definitely buggy, needs fixing. |
@nunoarruda @anseki The search viewlet goes through different code paths:
Please create a separate issue for aligning multiline find in the search viewlet. |
This will be addressed with #13155, right? |
@roblourens what does "global search" mean in #13155? I thought it was about searching in multiple files, which this issue is not, but please correct me if I'm wrong. |
@rebornix This might be a non-issue with our new textbuffer / search implementation? i.e. there is no longer a need to optimize searching line-by-line |
No longer see above issues as our new text buffer doesn't try to do line by line optimization anymore. |
Version 1.3 supported Multiline Find, but Regular Expression seems not work completely.
\s
doesn't match line breaks.[^]
doesn't match line breaks. We have to use[\s\S\n]
instead of[^]
to make it match any character.The text was updated successfully, but these errors were encountered: