Open paulobuchsbaum opened 2 years ago
This extension only supports regular expressions that are supported by the Javascript language. Building a custom regex engine isn't exactly something I want to build and support in the long term.
@paulobuchsbaum, it sounds like you want something like VS Code's "Match Whole Word" find option, which essentially just wraps your search with \b
(though it first checks to see if it's needed or not on each end), see microsoft/vscode src/vs/base/common/strings.ts#L182-L189.
VS Code also has EditorOption.wordSeparators
for "[c]haracters that will be used as word separators when doing word related navigations or operations." (source):
`~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
... But I don't believe that's used for finding/searching, but rather for selecting / navigating / etc.
If I'm understanding you correctly, as to your suggestion:
Similar functionality could be added, I do find it convenient occasionally to use VS Code's "Match Whole Word" find option, though more often I just manually add \b
as desired, since I usually leave "Use Regular Expression" on, and when I toggle other less-used options on ("Match Whole Word", "Match Case"), I sometimes forget that I've done so and waste time being confused as to why I can't find something.
Great tool because, standard search tool in Chrome (the most used browser by far) sucks. It's just a very basic search.
So it would be immensely useful for almost all users if this tool (Find + Regex) had the whole word option (similar to Office and other tools)
I know that it would be possibile to reproduce it using regular expression:
Where one need to replace the item with the desired word.
I like this regex because it extends the word concept and considers (, ), {, }, [, ], |, \, /, <, >, = and – as word separators. This approach includes numbers (in many formats) within the whole word concept and and additionally fits many foreign languages.
However, using regex to simulate whole word is very clumsy.