You do this using the filterCallback option of the filterable widget. Basically, override the default filter to compare the search text against the text with all punctuation stripped out:
<form class="ui-filterable">
<input id="myFilter" data-type="search"></input>
</form>
<div class="elements" data-filter="true" data-input="#myFilter">
<p class="parag">This is paragraph one or 1; it's not number 2</p>
<p class="parag">Next is two too 2.</p>
<p class="parag">Three 3! is after 2</p>
<p class="parag">Finally is, 4 four but; 'not" two.</p>
</div>
$(document).on("pagecreate", "#page1", function()
$(".elements").filterable('option', 'filterCallback', NoPunctuation);
});
function NoPunctuation( idx, searchValue ) {
var ret = false;
if (searchValue && searchValue.length > 0){
var filttext = $(this).data("filtertext") || '';
filttext = filttext.toLowerCase();
var text = $(this).text().toLowerCase();
var punctRE = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#\$%&\(\)\*\+,\-\.\/:;<=>\?@\[\]\^_`\{\|\}~]/g;
var spaceRE = /\s+/g;
text = text.replace(punctRE, '').replace(spaceRE, ' ');
console.log(text);
if( text.indexOf(searchValue.toLowerCase()) < 0 && filttext.indexOf(searchValue.toLowerCase()) < 0){
ret = true; //filter this one out
}
}
return ret;
}
To strip punctuation, I used an answer from here: How can I strip all punctuation from a string in JavaScript using regex?