Regex?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
vfatica
Posts: 50
Joined: Thu May 21, 2015 7:06 pm

Regex?

Post by vfatica »

The example given in the search docs,

Code: Select all

regex:[^]a-zA-Z0-9`~!@#$%^&*()[\;',<>./:">?{}|_+= -]
to fine filenames containing non-ascii characters works as advertised, finding 10 files here. But if I remove the double quote from that list of characters, the search results are empty. I'd expect the results to stay the same (or grow). What's up with that?
Thanks.
- Vince
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Regex?

Post by therube »

Search me, or should I say Regex me?
I don't even understand the [^] part?
vfatica
Posts: 50
Joined: Thu May 21, 2015 7:06 pm

Re: Regex?

Post by vfatica »

I don't get that either. I'm accustomed to [^character_list]. But if I move the ']' in "[^]" elsewhere in the list, the search fails.
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex?

Post by void »

In the set: [^]...]

[ = Start of Set
^ = Don't match characters in the set (Exclude)
] = Immediately after the ^ will include ] in the set and does not close the set as it usually would.
...] = the rest of the set including the set terminator ].

See [ ] in:
http://en.wikipedia.org/wiki/Regex#POSI ... d_extended
vfatica
Posts: 50
Joined: Thu May 21, 2015 7:06 pm

Re: Regex?

Post by vfatica »

Thanks. How about the first post in this thread?
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex?

Post by void »

The double quote is something I've overlooked with the regex: term.
The double quote is ignored in this case, but is useful for escaping the white space and | towards the end of the set.

It will work correctly if you remove the double quote, enable regex from the search menu and search for:

Code: Select all

[^]a-zA-Z0-9`~!@#$%^&*()[\;',<>./:>?{}|_+= -]
void
Developer
Posts: 16669
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex?

Post by void »

The quote should be escaped with quot:
The | escaped with #174:
The white space escaped with " "

Code: Select all

regex:[^]a-zA-Z0-9`~!@#$%^&*()[\;',<>./:quot:>?{}#174:_+=" "-]
vfatica
Posts: 50
Joined: Thu May 21, 2015 7:06 pm

Re: Regex?

Post by vfatica »

It works with all those changes.
Post Reply