Input field for filtering

I have an input field that I use to filter the data on the page. This is the code:


$(document).ready(function() {
        $('input[name=ricerca]').keyup(function(){
                $val=$(this).val();
		$('tbody tr:not(:contains("' + $val + '"))').hide();
		$('tbody tr:contains("' + $val + '")').show();
	})
});

Right now I can only filter by one value. What I would like to do is give the user the possibility to filter by two or more values. For example, if the users inserts this into the input field: “city, date” the data will be filtered by both the values of city and date.

How can I modify the code to say that ", " is a delimiter?