Regular Expression searching

Regular Expression searching

briankatesbriankates 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

Answers

  • bek816bek816 Posts: 5Questions: 2Answers: 1
    Answer ✓

    Solved it with a new regex:

    ^(Virginia)$

This discussion has been closed.