Change regex

Change regex

dfigueiradfigueira Posts: 15Questions: 3Answers: 0

Hi guy's,

I'm using the column filter. Trouble is that when I am searching for phrases that include "(", it will fail the search. How can I ignore this on the regex, considering I am already matching the whole word?

table.column(colIdx).search("^" + searchString + "$", true, false).data().draw();

Thank you

Answers

  • kthorngrenkthorngren Posts: 21,570Questions: 26Answers: 4,996

    You will probably want to use the escapeRegex function to use the `(`` as part of the search and not a regex special character:
    https://datatables.net/reference/api/%24.fn.dataTable.util.escapeRegex()

    Kevin

  • dfigueiradfigueira Posts: 15Questions: 3Answers: 0

    Well, I did it. Added a regex, ignoring the "|" to add the multiple values on the search string of each column. But now I am having a new problem, when searching for values that have html around it. Any idea how I can skip this or I would have to revogue the html?

  • kthorngrenkthorngren Posts: 21,570Questions: 26Answers: 4,996

    Can you provide examples of what you are trying to search?

    Kevin

  • dfigueiradfigueira Posts: 15Questions: 3Answers: 0
    edited March 2017
    <span>
        Text
    </span>
    

    In some places are like that - labels. Other places is direct text without any spans around them.

This discussion has been closed.