Regex Search

Regex Search

BPATBPAT Posts: 28Questions: 13Answers: 1

Forgive me I am not a smart person, but I have this working to a point.
table.columns([6]).search( DataFilters[3] ? '^'+DataFilters[3]+'$' : '', true, false ).draw();

I have something in the filter value that contains something like Title Title Tile (Title) value in it, so am wondering if any smart Regex folks could offer some help? I think the ( and ) are throwing off the filter?

Thank you for any help you can provide me.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,173Questions: 26Answers: 4,923
    Answer ✓

    One place to start is with the https://regex101.com/ site. Its a good place to learn regex and to build working expressions. If you still need help with this please provide a simple test case with an example of your data and what DataFilters[3] would contain. Without seeing exactly the data you have it will be very difficult to help build the proper search term.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • BPATBPAT Posts: 28Questions: 13Answers: 1

    System Access Documents (CVS) is DataFilter[3]. It works when I just do a regular search but I have other cases where I can't just use regular search because I have to match the whole filter phrase. Thanks for the response.

  • BPATBPAT Posts: 28Questions: 13Answers: 1
    edited October 2020

    I think I got it. Thanks for pointing me in the right direction. Actually it didn't work, I just had the regex based search commented and the regular search was on. Sigh.

    table.columns([6]).search( DataFilters[3] ? '^.'+DataFilters[3]+'$' : '', true, false ).draw();

This discussion has been closed.