Skip to main content
Topic: Help with filter/regexp in Facets ! (Read 377 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help with filter/regexp in Facets !


I'm using the Facets plugin and struggling getting a filter working in Foobar and could use some help!  I basically want to filter the results where the start of the directory in the path is either "VA-" or "VA_-_" but with my limited knowledge of regular expressions its proving difficult!

This is what I have and I realise it doesn't test for "VA-" or "VA_-_", only "VA" but it's not working regardless.


Any help is much appreciated.


Re: Help with filter/regexp in Facets !

Reply #1
Not too sure about this but try it.


Re: Help with filter/regexp in Facets !

Reply #2
Thanks Jazzthief, I tried it but didn't work, it gives a syntax error.

I modified your expressions and found the following worked but doesn't obviously look for and find any of the "VA_-_" matches...


Re: Help with filter/regexp in Facets !

Reply #3
Read this:

Check if path contains 'VA-' (will evaluate true or false):
Code: [Select]

Check if path contains 'VA-' OR 'VA - ':
Code: [Select]
$or($strstr(%path%,VA-),$strstr(%path%,VA - ))

Wrap it inside an $if() function to decide what happens if it evaluates true or false:
Code: [Select]
$if($or($strstr(%path%,VA-),$strstr(%path%,VA - )),TRUE,FALSE)

Show %album% only if it the statement evaluated true:
Code: [Select]
$if($or($strstr(%path%,VA-),$strstr(%path%,VA - )),%album%,)

You may opt to substitute this for the first code in my post:
Code: [Select]
It ensures that the matches are folders and also that they are exactly N level above the current track by swapping '%path%' with '$directory(%path%,1)'. Currently N is 1, which means the same folder as the file resides in. 2 would mean 2 levels above and so on. If you have variable directory structure this obviously won't work.


Re: Help with filter/regexp in Facets !

Reply #4
Hi Daeron,  thank your for the expressions this line works great ...
$if($or($strstr(%path%,VA-),$strstr(%path%,VA - )),%album%,)


One problem with it is that it evaluates the entire path for VA- and VA_-_  and it's showing results where the folder name starts with JVA, for example.  The reason I tried to use the $left operator was because I could rule out any false positives like this.  Could the expression above be  amended to search only the first 3 / 5 characters of the path or is this not possible.


SimplePortal 1.0.0 RC1 © 2008-2019