Jump to content

Advanced Selector Question

Recommended Posts

I want to find pages where the title has (word1|word2|word3) + word4.

Meaning if word1/2/3 and word4 were in a page title, then it would match.

I'm not sure if selectors can do this however?

title~=word1|word2|word3 word4

That unfortunately does not work correctly.  What am I missing?

Link to comment
Share on other sites

According to the specs it should work like this (not tested)
$results = $pages->find("title~=word1|word2|word3, title~=word4");

title=x, title=y is AND 

AND selectors: matching more than one value in the same field

There will be instances where you need to say that a specific field matches more than one selector. This is simple, just specify all the conditions you need to match as separate selectors in the same string. For example:

height>500, height<=1000

This AND selector matches all pages that have a "height" field greater than 500, and less than or equal to 1000.


title=a|b|c, title=y should be the right combination



  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...