Created
August 22, 2012 14:37
-
-
Save Neferetheka/3426203 to your computer and use it in GitHub Desktop.
Regex to search through html text
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
//Adapted from http://stackoverflow.com/questions/3460004/regexp-to-search-replace-only-text-not-in-html-attribute | |
var reg = new RegExp("(?![^<>]*>) *("+search+") *([^ \d])", "g"); | |
var resultsWithoutHTML = text.replace(reg, "toReplace"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment