Excluding rows from a matching search filter query (i.e. with search string "football -american"

Excluding rows from a matching search filter query (i.e. with search string "football -american"

davidodavido Posts: 2Questions: 0Answers: 0
edited July 2012 in General
Hi there, I can't find the documentation to do this, so apologies if It's an obvious question.

I'm applying a search filter to a dataTable on initialisation via oSearch. This is populated from a url query parameter.

i.e. datatable.php?filter=stars

This works fine as it only returns rows matching the search parameter.

The problem is this parameter still returns too many rows - I need to to exclude some rows from the results.

However I don't have an exact second string to match against, so what I really need to do is exclude the rows I don't want.

i.e. a search string along the lines of "stars -celebrity"

I've tried using the bRegex flag, but I can't seem to get that to work.

Any tips / advice, greatly appreciated!

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    I think it probably does come down to regex - how to match against a given string, but also not another string. Perhaps (?=football)(?=[^celebrity]) ? But I'm really not a regex expert I'm afraid, so this might be one that is better on SO or similar?

    Allan
  • davidodavido Posts: 2Questions: 0Answers: 0
    Cheers Allan, shall open it up to the SO crowd, shall update this thread if I get a solution.
This discussion has been closed.