Problem using regex: syntax

Found a bug in "Everything"? report it here
Post Reply
bobm
Posts: 23
Joined: Fri Aug 21, 2015 11:27 am

Problem using regex: syntax

Post by bobm » Wed Aug 26, 2015 11:32 am

In v686, if I enable regex searches using Ctrl R, matches are correctly returned for regex criteria such as:
12(3|4)4

However, switching regex off and using the regex prefix, ie
regex:12(3|4)4
it appears that the prefix is being ignored and returns matches no different from just using 12(3|4)4

I've tried the following without success:
regex:^.*12(3|4)4.*$

Checking the "Allow round bracket grouping" in the option menu makes no difference to results. However, using the following syntax produces the correct results, implying that the prefix is being recognised:
regex:12[34]4

I get the same results when using the web interface, which means other users can't use this type of regex query unless they access the index via the ETP server.

Am I doing anything wrong or is this a bug with the | character when used within curved brackets?

void
Site Admin
Posts: 6064
Joined: Fri Oct 16, 2009 11:31 pm

Re: Problem using regex: syntax

Post by void » Wed Aug 26, 2015 11:38 am

When regex is enabled from the Search menu, the entire search is treated as the regex expression.

When regex is disabled from the Search menu, the search is broken down into different terms.
| will split terms with the OR operator. regex:12(3|4)4 would become regex:12(3 OR 4)4

Use double quotes to escape the |

Code: Select all

regex:"12(3|4)4"

bobm
Posts: 23
Joined: Fri Aug 21, 2015 11:27 am

Re: Problem using regex: syntax

Post by bobm » Wed Aug 26, 2015 2:31 pm

Excellent, thanks very much for the clarification. That works fine.

To avoid confusion, maybe it would be worth adding a statement under the Regex section here:

http://www.voidtools.com/support/everything/searching/

to put all regex criteria in inverted commas whenever using the regex: prefix

Post Reply