regex to match before extension

General discussion related to "Everything".
Post Reply
redwood
Posts: 28
Joined: Sun May 02, 2021 2:32 pm

regex to match before extension

Post by redwood »

Hello, I want to search for files that contain both Arabic and English characters in any order in base name. I use a pattern but the problem is that it will match the extension as English characters as well. I need to match my string in any order and ignore extension
Arabic English.ext

regex:(?=.*[a-zA-Z])(?=.[*\x{0600}-\x{06ff}])
void
Developer
Posts: 16680
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex to match before extension

Post by void »

Please try the following:

regex:"([a-zA-Z].*[\x{0600}-\x{06ff}]|[\x{0600}-\x{06ff}].*[a-zA-Z]).*\.[^.]*$"

-or-

regex:[a-zA-Z].*[\x{0600}-\x{06ff}].*\.[^.]*$ | regex:[\x{0600}-\x{06ff}].*[a-zA-Z].*\.[^.]*$



For files that don't have an extension (maybe you want folders?), please try:

regex:"([a-zA-Z].*[\x{0600}-\x{06ff}]|[\x{0600}-\x{06ff}].*[a-zA-Z])(.*\.[^.]*|[^.]*)$"
redwood
Posts: 28
Joined: Sun May 02, 2021 2:32 pm

Re: regex to match before extension

Post by redwood »

I really appreciate this help and thank you very much.
each of them works well.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: regex to match before extension

Post by NotNull »

If you are using Everything 1.5, this can be done even simpler:

Code: Select all

regex:stem:[a-z]  regex:stem:[\x{0600}-\x{06ff}]
regex in Everything is case-insensitive, so [a-z] will also match A-Z


(untested, btw)
redwood
Posts: 28
Joined: Sun May 02, 2021 2:32 pm

Re: regex to match before extension

Post by redwood »

this is even better. finds files and folders without worrying about the extension. thank you!
Post Reply