var originalString="Something to search"; //Create new RegExp object. if you dont use second parameter, //search method is match case var keyword = new RegExp("text to search here","i"); var result = originalString.search(keyword);//Return index of keyword you have search. // Otherwise return -1
No comments:
Post a Comment