Smart Filtering and Regex

Smart Filtering and Regex

quytennisquytennis Posts: 14Questions: 0Answers: 0
edited May 2012 in General
Can someone please explain what happens if I turn on/off Smart Filtering and turn on/off Regex?

The documentation is not very straightforward:
http://datatables.net/examples/api/regex.html


Quy

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Smart filtering - DataTables will use a regular expression to break apart the filtering input by whitespace, and attempt to match individual components anywhere in the row. For example "red green" would be found in a row that has "This red row has a hint of green". Without the smart filtering an 'indexOf' is done, so that row would not match.

    Regex - By default DataTables will escape regular expression special characters (* etc) so they don't inadvertently trigger filtering the user wouldn't expect (for example, a "typical" user wouldn't expect a "." to match any character). You can turn that off if you do want to use regular expressions.

    If you want to use regular expressions, I'd suggest also turning off smart filtering, since it itself uses regex and the two combined and do "odd things".

    Allan
This discussion has been closed.