regex to match before extension

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

regex to match before extension

Post by redwood » Wed Sep 21, 2022 2:24 pm

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: 10236
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex to match before extension

Post by void » Wed Sep 21, 2022 11:59 pm

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: 21
Joined: Sun May 02, 2021 2:32 pm

Re: regex to match before extension

Post by redwood » Thu Sep 22, 2022 2:44 am

I really appreciate this help and thank you very much.
each of them works well.

NotNull
Posts: 3847
Joined: Wed May 24, 2017 9:22 pm

Re: regex to match before extension

Post by NotNull » Fri Sep 23, 2022 9:44 pm

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: 21
Joined: Sun May 02, 2021 2:32 pm

Re: regex to match before extension

Post by redwood » Sat Sep 24, 2022 12:22 am

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

Post Reply