Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // strip all slashes (ignored by search anyway)
- var reVal = this.val().replace(/[\\\/]/,'');
- // strip all non alpha-numeric (or space) chars too
- reVal = reVal.replace(/[^a-zA-Z0-9 ]/,'');
- // make a regexp to match before, 'val()' and after
- var regex = new RegExp('(.*?)('+reVal+')(.*?)', 'i');
- // inject styling
- name = name.replace(regex, '$1<span class="blq-search-underline">$2</span>$3');
Add Comment
Please, Sign In to add comment