REGEX:PROPERTIES

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
deatro
Posts: 4
Joined: Wed May 18, 2022 11:37 pm

REGEX:PROPERTIES

Post by deatro »

I'm new to regex, and I wanna isolate/filter my file search by numerical characters so I've used [0-9] which works. But i also want to limit my filename count; (i.e. filenamelength:10) but it doesn't work in regex. How do I fix this?
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: REGEX:PROPERTIES

Post by void »

Instead of using Regex from the search menu, use the regex: search modifier.

Please try the following search:

regex:[0-9] len:10



How many digits-characters do you want to match?
Is it just one?

or do you want to match filenames with all digits:
regex:^[0-9]+$ len:10

^ = match the start of the filename
+ = match the previous element one or more times.
$ = match the end of the filename.



Is there a file extension?
regex:^[0-9]+\.[^.]+$ len:10

\. = match a literal .
[^.] = do not match a literal dot.



If you wanted to match exactly 10 digits in pure regex (regex enabled from the Search menu), please try the following search:

^[0-9]{10}$

{x} = match the previous element x times.
deatro
Posts: 4
Joined: Wed May 18, 2022 11:37 pm

Re: REGEX:PROPERTIES

Post by deatro »

Thank you that was very helpful! However I wanted to isolate filenames with just numerical values. For example:

including:

i.e; 0145960100.jpg

excluding:

i.e; 009BHIX009.jpg

I hope that makes sense.
deatro
Posts: 4
Joined: Wed May 18, 2022 11:37 pm

Re: REGEX:PROPERTIES

Post by deatro »

I'm sorry I think you answered my question in the second part of your answer. That totally worked! Thank you!
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: REGEX:PROPERTIES

Post by void »

i.e; 0145960100.jpg
Please try:

regex:^\d{10}\.jpg$

^ = match start of filename
\d = match a DIGIT -same as [0-9]
{10} = match 10 of the previous element
\. = match a literal dot (.)
$ = match the end of the filename
Post Reply