Q: Regex to find modified images.
Q: Regex to find modified images.
Hi,
I have several files of this format where the modified image has "-1" added
"C:\Dropbox\Camera Uploads\2023-07-18 18.45.43.jpg"
"C:\Dropbox\Camera Uploads\2023-07-18 18.45.43-1.jpg"
I am trying to create a search that will find all these pairs
My attempt look like this: regex:"(^.*)-1\.jpg|\1"
The regex finds all files that end with -1.jpg and captures the start of the filename in group 1
Then the |\1 should match all files with just the content of capture group 1.
This does not work.
regex:"(^.*)-1\.jpg" correctly finds all the modified files and the regular-expression-match-1 column contains the correct value. (2023-07-18 18.45.43)
manually recreating the capture group like regex:"(^.*)-1\.jpg|2023-07-18 18.45.43" does work.
What is the correct way to do this?
---
Regards Morten
I have several files of this format where the modified image has "-1" added
"C:\Dropbox\Camera Uploads\2023-07-18 18.45.43.jpg"
"C:\Dropbox\Camera Uploads\2023-07-18 18.45.43-1.jpg"
I am trying to create a search that will find all these pairs
My attempt look like this: regex:"(^.*)-1\.jpg|\1"
The regex finds all files that end with -1.jpg and captures the start of the filename in group 1
Then the |\1 should match all files with just the content of capture group 1.
This does not work.
regex:"(^.*)-1\.jpg" correctly finds all the modified files and the regular-expression-match-1 column contains the correct value. (2023-07-18 18.45.43)
manually recreating the capture group like regex:"(^.*)-1\.jpg|2023-07-18 18.45.43" does work.
What is the correct way to do this?
---
Regards Morten
Re: Q: Regex to find modified images.
I have now realized that of cause I can not use capture groups to find stuff in other file names. It is naturally one line at a time.
But my question still stands: How can I find these files?
But my question still stands: How can I find these files?
Re: Q: Regex to find modified images.
regex:"(^.*)-1\.jpg
2023-07-18 18.45.43
I'm thinking...
You need to "group" the 2023, <2023-07-18 18.45.43>
So....
viewtopic.php?p=58761#p58761
2023-07-18 18.45.43
I'm thinking...
You need to "group" the 2023, <2023-07-18 18.45.43>
So...
<2023-07-18 18.45.43> | regex:(^.*)-1\.jpg
viewtopic.php?p=58761#p58761
Re: Q: Regex to find modified images.
There is also a way to find name / name-1 pairs kind of thing, just like you're looking to do.
(I don't recall how, but it is mentioned in these parts.)
(I don't recall how, but it is mentioned in these parts.)
Re: Q: Regex to find modified images.
Untested ...
For jpg files
For any file extension:
file-exist:
For jpg files
Code: Select all
file: < regex:"^(.*)-1\.jpg$" fileexists:\1.jpg > | < regex:"^(.*)\.jpg$" fileexists:\1-1.jpg >
For any file extension:
Code: Select all
file: < regex:"^(.*)-1\.([^.]+)$" fileexist:\1.\2 > | < regex:"^(.*)\.([^.]+)$" fileexist:\1-1.\2 >
Re: Q: Regex to find modified images.
That worked!
I had not seen file-exists: before.
I did try to use \d in file-exists: to match any number -1, -2, -3.... but that did not work for me.
Is there a syntax where I can do something like that? (ie: fileexists:\1-\d.jpg)
I had not seen file-exists: before.
I did try to use \d in file-exists: to match any number -1, -2, -3.... but that did not work for me.
Is there a syntax where I can do something like that? (ie: fileexists:\1-\d.jpg)
file: < regex:"^(.*)-\d\.jpg$" fileexists:\1.jpg > | < regex:"^(.*)\.jpg$" fileexists:\1-\d.jpg >
Re: Q: Regex to find modified images.
There is, but it will probably be quite taxing on your system (better to test first with a small folder):
Code: Select all
file: < regex:"^(.*)-\d\.([^.]+)$" regex:siblingname:^$1:\.$2:$ > | < regex:"^(.*)\.([^.]+)$" regex:siblingname:^$1:-\d\.$2:$ >
Re: Q: Regex to find modified images.
There is a reason this tool is called EVERYTHING! I never stop being amazed about all the stuff in here!
Unfortunately any attempt to use regex:siblingname: on even a small directory with 596 items crashes after a couple of seconds.
But I have two questions.
Unfortunately any attempt to use regex:siblingname: on even a small directory with 596 items crashes after a couple of seconds.
But I have two questions.
- Why does siblingname work with regex but fileexists does not?
- How am I supposed to find my way in all these options without help from someone that happens to know? (Thank you to NotNull!)
Re: Q: Regex to find modified images.
Thank you for the crash report, I'll have this fixed in the next alpha update.
The crash is caused by a regex optimization.
I'll post a fix here once it's ready for testing.
For now, please try:
The crash is caused by a regex optimization.
I'll post a fix here once it's ready for testing.
For now, please try:
Code: Select all
file: < no-fast-regex:regex:"^(.*)-\d\.([^.]+)$" no-fast-regex:regex:siblingname:^$1:\.$2:$ > | < no-fast-regex:regex:"^(.*)\.([^.]+)$" no-fast-regex:regex:siblingname:^$1:-\d\.$2:$ >
Re: Q: Regex to find modified images.
1. fileexists: requires an exact filename, not a (regex) pattern.
2. They are listed here for now (alpha version). That will be put on the support pages in the future.
But there are lots of helpful people here on the forums to help you out (there are indeed a lot of options ..)
2. They are listed here for now (alpha version). That will be put on the support pages in the future.
But there are lots of helpful people here on the forums to help you out (there are indeed a lot of options ..)
Re: Q: Regex to find modified images.
Everything 1.5.0.1353a fixes a crash when capturing text with regex.
Re: Q: Regex to find modified images.
The search that crashed before, now ran quickly on my entire disk.