We will print to the webpage if it contains the character in the string otherwise not. Let us first create a table −. var str = $('#Search').val(); if(/^[a-zA-Z0-9- ]*$/.test(str) == false) { alert('Your search string contains illegal characters. This method is much easier to use as it returns a boolean. Check if String Contains a Specific Word in JavaScript This is the most generous of the jQuery attribute selectors that match against a value. The \d character class is the simplest way to match numbers. 043 700 752; info@giftshop.com; toyota hilux 2021 for sale; delta moss paint color. Check Regex. It … To check whether string contains particular text or not in jQuery we need to write the code like as shown below.