Reqular Expression and Multi-level Data-driven Categories

Started by Frank, June 29, 2013, 07:37:35 AM

Previous topic - Next topic

Frank

I would like to use "Multi-level Data-driven Categories" out of one Value. As far as I undestand is this possible with regular expression.

Excample:
Value: Mario_Westphal

The first level of category should be the first appearance after the splitting caracter "_"
Result:
W


The second level should be the second Value after the splitting caracter "_"
Result:
W
-> Westphal

The third level should be the whole value without splitting.
Result:
W
-> Westphal
-> -> Mario_Westphal


Is this somehow possible with dynamic categories?

kind regards
Frank

Mario

This is really complicated. How much have you already archived?
Splitting at the _ is easy, there is an option for that.
Using the first character is also possible (Auto-Group)
You now only need to setup a regular expression which extracts the part before the _ and the part after _ for the other level.
But regular expressions for data-driven categories are meant to be used as filters to control which values are used for the category.
You will need to make some experiments if this is possible.

Do you know the handy Regular Expression Tester script that is shipped with IMatch ?
The IMatch help on regular expressions also has some pointers to web sites with tutorials.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Ferdinand

I am trying to do something similar, and simpler.  I guess the question is:  Can it be done?  is it worth persevering with?

I want a dynamic cat based on a single character in the file name - not at the beginning or end and not always in the same numerical position  If I was to use regex to extract it, then it would be:

[0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+_[0-9]+-([a-zA-Z0-9]).*

but since the filters for dynamic cats are just that I haven't been able to.  I.e.  I assume I can't use () to highlight a term.  I can make some progress, but not enough.

I have a hunch that if the option to extract a sub-string ran *after* the filter then it may work, as I could replace the first part with nothing and then extract the next character.