Guest User

Untitled

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