Formula to find a string sequence not doing what I'd like.

Started by photophart, January 29, 2020, 05:23:20 PM

Previous topic - Next topic

photophart

I'm VERY new to iMatch and am impressed so far. I'm trying to write a formula for a category that will return all files with a filename that contains this: "_print" as part of the filename.
I've tried using "@FileRegExp[_print]" and this does return files that contain the _print string but it also returns files that begin with "_", the underscore. Which is not what I'm after.
Regular expressions are a new area for me, I'm learning, but still a bit lost. I also tried "@FileRegExp[_print$]" which also doesn't seem to be correct.
My background leans more toward SQL so what I need is an expression that does something like: $ contains *"_print"*. Hope that makes sense.
Regards, Mark

Mario

Tip: If you use the RegExp tester app, you can test your regular expressions easily. You find it in the App Manager panel.

I've made a quick check with two files:

beach_print.jpg
_beach.jpg


and this formula:

"@FileRegExp[_print]"

The formula only returns beach_print.jpg but not _beach.jpg
Make sure to enclose the formula in ".

Note: Using this formula forces IMatch to search your entire database by file name every time the category needs to be refreshed. This can bring down performance quite a bit.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Are you sure you need a category for this?
I do something like this with a filter preset- filter by file name: ends with: _print
( And of course you could just use the search function by typing in "_print". )
IM gives you many ways!


A category will be of use if you want to do some extensive filtering; for just selecting files having this name pattern a category is (IMHO) overkill.

photophart

#3
Laziness, the impetus behind some of humanity's greatest achievements was clearly my primary motivator for the category idea. I was looking for a one-click short cut to something I do frequently. Yes, I could have used a filter, have used a filter, but that involves more than one click as well as some typing and I'm, you know....

Anyway, I did get this working and it works nicely. Looks like I'm going to have to buy Mario's product as it's already insinuating itself into my work environment and  this is just the trial product. It's capabilities fit well with how I do things.

Speaking of filters: I haven't found "filter presets" yet, having only just started exploring iMatch, but I'll go looking for them immediately.

Thanks for the tip.
Regards, Mark

Mario

See: The Filter Manager for more information.

This offers also a one-click solution to your "Find all files with names containing _print."
In addition with allowing you to apply that to the current scope.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook