troubleshooting Question

JQuery Search Filter

Avatar of Ridgejp
RidgejpFlag for United Kingdom of Great Britain and Northern Ireland asked on
2 Comments1 Solution388 ViewsLast Modified:

I'm currently using a JQuery Search filter that up until now has performed brilliantly ... but I'd like to tweak it to handle 'character spaces' in the search terms.

The query looks like this currently: -

    $(document).ready(function () {
		(function ($) 
			$('#filter').keyup(function () {
            var rex = new RegExp($(this).val(), 'i');
            $('.searchable tr').hide();
            $('.searchable tr').filter(function () {
                return rex.test($(this).text());



The search function fails if I search a record set returned into a bootstrap table using mysql as it will only find results where there is no character spacing. So if a product code is present in the returned record set such as "WHITE OVERSHOES" (by way of example) I would have to search for "WHITE"  or "OVERSHOES" as it would not be able to find "WHITE OVERSHOES" on account of the space.

How do I change this?

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros