Regular Expression searching
Regular Expression searching
briankates
Posts: 2Questions: 2Answers: 0
In my table, I have several rows each with a state name. I'm using Chosen.js to allow a multi-filter (search). If the user selects "Virginia", I'm seeing results for "Virginia" and "West Virginia".
I'm generating the select items via:
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
And I'm searching on change with:
column
.search( searchExpression, true, false )
.draw();
My search expression is: "\b(Virginia)\b"
Any suggestions how I can get the search to return only "Virginia"?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Solved it with a new regex:
^(Virginia)$