Created
July 13, 2010 04:37
-
-
Save pete-otaqui/473455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment