Jumping Versions with regex
jrsndl opened this issue · 3 comments
Can you please point me to documentation on ow to write regex for detecting versions?
It is great feature, but I can't make it to for for typical folder structrures like:
foo/shot_v001/shot_v001.1001.exr
foo/shot_v002/shot_v002.1001.exr
or
bar/shot/v001/shot_v001.1001.exr
bar/shot/v002/shot_v002.1001.exr
Thank you
In principle, the default of _v should have worked for your first example (and I just checked it works me):
foo/shot_v001/shot_v001.1001.exr
foo/shot_v002/shot_v002.1001.exr
The actual regex that is created when you have "_v" is the following:
([\w:/]*?[/\._]_v)(\d+)([%\w\d\./]*)
You need to make the regex match three groups: a prefix ([\w:/]*?[/\._]_v)
, the actual version (\d+)
and the suffix ([%\w\d\./]*)
.
I think for your second example, the regex you may need might be:
([\w:/]*?[/\._]v)(\d+)([%\w\d\./]*)
In principle, the default of _v should have worked for your first example (and I just checked it works me):
it doesn't work for me (Windows 10, UNC path)
following: ([\w:/]?[/._]_v)(\d+)([%\w\d./])
Not sure what regex flavor is used, but it looks like some slashes need to be escaped? When I use this regex, or _v, mrv2 doesn't even show top menu Image item.
When I add (.*_v)(\d+)([%\w\d\.\/]*)
instead, I see this in the log:
When I try simple (.*_v)(\d+)(.*)
that should match the first occurence of the _v in the path foo/shot_v001/shot_v001.1001.exr, the log is the same.
Maybe the regex is not counting with backslashes on Windows?
Here's a regex that seems to work for me on Windows' UNC paths. Just copy it verbatim to the Preferences->Loading->Regex option:
([\w\\:/]*?[/\._]*_v)(\d+)([\w\d\./]*)
I've updated the default _v regex to match that. It will be there in v0.9.5 or when the beta finishes compiling on sourceforge.