开发者

Re: Regex Question (Help)

开发者 https://www.devze.com 2023-03-28 19:13 出处:网络
I am new here. I just discovered this tool \"Everything Search Engine\". It allows the use of regex in the search. I posted in their forum for a bit help here http://forum.voidtools.com/viewtopic.php?

I am new here. I just discovered this tool "Everything Search Engine". It allows the use of regex in the search. I posted in their forum for a bit help here http://forum.voidtools.com/viewtopic.php?f=5&t=1343. This section explains how regex can be used in the tool http://www.voidtools.com/faq.php#How_do_I_use_regex.

The question I am asking is:开发者_Python百科

What is the correct regex to use in the search to obtain the desired results describe below.

For example, I am searching for the word "dog" in the file name. And it returns a result "Pseudogout" which is a file name.

Notice the word "dog" is inside the word "Pseudogout".

How do I use the regex to eliminate such results?

I would appreciate some help here.

Thanks.


Use anchors: ^dog$. The caret matches the beginning of a string, and the dollar sign, the end.

If you want to match the string "dog" inside another string, but not inside another word, you might be able to use something like ^dog$|^dog[^A-Za-z]|[^A-Za-z]dog[^A-Za-z]|[^A-Za-z]dog$ but that is obviously somewhat cumbersome to type and use.

(This subsumes some information from the comments below.)

0

精彩评论

暂无评论...
验证码 换一张
取 消