Finding versions that have spaces in the filenames

Started by DavidOfMA, November 19, 2014, 04:44:59 PM

Previous topic - Next topic

DavidOfMA

Some of my very early version files have one or more spaces in the filenames, and versioning doesn't appear to find them. For instance, an original file might be 1234_IMG.JPG and the versions might be "1234_IMG edited 01 a" or 1234_IMG 01," and so on. (My initial naming conventions were pretty arbitrary.). Using the "do everything" search string mentioned in the help file doesn't appear to find them. This is what I am using: ^(_*{name})[+\-_]*[0-9|a-z]*\.(jpg|jpeg)$

How can I get this string to also find files that include spaces (or other separators) in arbitrary positions? Adding a space to [+\-_] catches the file names like "1234_IMG 01" but not "1234_IMG 01 a" or "1234_IMG 01 a edited" There are too many files involved for me to rename them with a better numbering scheme, so I hope there is a regular expression way to do this.

Also, some of the master filesnames also have spaces in them, sometimes also in arbitrary positions. Do I need to do anything special to use these as master files?

Thanks,
David

P.Jones

#1
Quote from: DavidOfMA on November 19, 2014, 04:44:59 PM
Some of my very early version files have one or more spaces in the filenames, and versioning doesn't appear to find them. For instance, an original file might be 1234_IMG.JPG and the versions might be "1234_IMG edited 01 a" or 1234_IMG 01," and so on. (My initial naming conventions were pretty arbitrary.). Using the "do everything" search string mentioned in the help file doesn't appear to find them. This is what I am using: ^(_*{name})[+\-_]*[0-9|a-z]*\.(jpg|jpeg)$

How can I get this string to also find files that include spaces (or other separators) in arbitrary positions? Adding a space to [+\-_] catches the file names like "1234_IMG 01" but not "1234_IMG 01 a" or "1234_IMG 01 a edited" There are too many files involved for me to rename them with a better numbering scheme, so I hope there is a regular expression way to do this.

Also, some of the master filesnames also have spaces in them, sometimes also in arbitrary positions. Do I need to do anything special to use these as master files?

Thanks,
David

Try something like  ^(_*{name})[+\-_]*[0-9|a-z| ]*\.(jpg|jpeg)$

thats a | then space after |a-z

forgot to add I use

^{name}.*\.jpg$

seems to work and catches everything

DavidOfMA

#2
Thanks. I'll try that. Is the full syntax explained somewhere? It would help to understand the logic. I haven't constructed regular expressions in many years, and the cheat sheets I've found on the web haven't clarified the logic enough for me to construct a good matching string.

P.Jones

Quote from: DavidOfMA on November 19, 2014, 07:19:52 PM
Thanks. I'll try that. Is the full syntax explained somewhere? It would help to understand the logic. I haven't constructed regular expressions in many tears.

Search Help for Versioning and Regular Expressions

DavidOfMA

#4
Thanks. I read the help on versioning and regular expressions before I posted. From now on I'm prefacing each request with that. I only post after I can't figure out how to do something after reading the help and searching the forum, web, or both.

Just saw your addendum. I think ^{name}.*\.jpg$ should work for me, too. If I understand correctly, it means "starts with the file name, followed by any number of characters, and ends with jpg". Is that correct?

Carlo Didier

Concerning regular expressions, there are many good sites to help you. Example: http://www.regular-expressions.info/tutorial.html
I also use RegexBuddy to test my expressions (see attached screenshot). There are other tools like it, also free ones, that are very helpful.

[attachment deleted by admin]

Mario

I ave linked to several online resources in the regular expression topic in the help as well. And you can use the integrated test feature in the File Relations dialog box to test your expressions. RegExpBuddy may be a help if you really want to do something complex - but in most cases, users coming up with way to complex regular expressions.

Often a master like \.nef$ and a version like {name}\.jpg$ is all that's needed.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

DavidOfMA

Thanks for the pointers to the RegEx site and the existence of RegEx tools (I've installed Expresso and will learn it.) I get the basic logic, but have one (hopefully) quick question.

Many of my masters have spaces in the filenames and include Roman numerals at the end. I have not yet been able to figure out a RegEx expression that will prevent filenames with lower Roman Numerals from matching ones with higher Roman Numerals that begin with the same letter. For instance, "Beach Rose I" matches not only "Beach Rose I" but also "Beach Rose II", "Beach Rose III", and "Beach Rose IV," and "Beach Rose I" sometimes (but not always) becomes the master of "Beach Rose II" even though a master "Beach Rose II" exists. There are similar incorrect matches with other masters that have spaces, too. I could rename all the files that have spaces so they no longer have spaces, but this would mess up several projects.

Is there, as far as you can tell, any way to have a regular expression in which "Beach Rose I" matche only "Beach Rose I" and not also "Beach Rose II" and other files that begin with "Beach" or "Beach Rose"?

Thanks,
David

DavidOfMA

On a related note, is there any way to unlike an incorrectly matched version that has been linked through a rule? I know I can unlink manual master/version links, but if I can't get this to work using a rule, in addition to linking, say, "Beach Rose III" with the "Beach Rose III" versions, I'd also like to unlink "Beach House" from "Beach Rose I."

Carlo Didier

Uh, oh, roman numerals ... now that's a bad thing IMHO.
As Mario says, a simple relationship mapping {Name}\.jpg to .\nef for example should work, but if you use roman numerals, you get into trouble if someday you want to use postfixes in your filenames, like filename.nef as master an the filename.jpg and filename_web.jpg and filename_print.tif, etc as versions. Difficult then to make the difference between files like "filename II.jpg" and "filename I web.jpg" to say for which masters they are a version of ...

DavidOfMA

I created these images long before versioning was around, but now I'm stuck with them and trying to find a way to get versioning rules to work with them. Might not be possible, but I'm new to regular expressions and am putting it out there in case someone more clever than I am has an approach.

Thanks.

David

P.Jones

Quote from: DavidOfMA on November 20, 2014, 06:07:36 PM
I created these images long before versioning was around, but now I'm stuck with them and trying to find a way to get versioning rules to work with them. Might not be possible, but I'm new to regular expressions and am putting it out there in case someone more clever than I am has an approach.

Thanks.

David

Couldn't you rename them with a new naming system

DavidOfMA

#12
Many of them are linked into book projects and websites using the current names. Renaming would mean redoing all the links in the books and websites, which would be very time-consuming. Plus, there are thousands of images with about 350 masters.

I wonder if there is a way to specify that the characters after {name} NOT include the uppercase characters I,V,X. For my purposes that would distinguish Beach Rose I and Beach Rose II, which is my main problem so far.

Is there a way to say: match {name} followed by any character string EXCEPT uppercase I,V, or X? I think that will cover these images without messing anything else up, but I don't seem to be able to work out the syntax.

Thanks,
David