Values could be mixed in the string with other values?... I was thinking that using .length property is a good idea with .trim() for in case your data has whitespaces or the value is mixed in the string. Nice presentation!... Thank you!
Is this codeigniter 3? can you do that with serverside dataTable and on top of the page wit database query filtering the data with drop down or radio button.