Yea the script way would be best, or even just a find/replace throughout all your files. I’m not very good with regular expressions, but in case you can’t edit them that way, and assuming all hrefs use double quotes:
$('a').click(function(){
var $this = $(this)
var src = $this.attr('src')
if(src.indexOf('javascript:') === 0){
var parts = src.split("'")
$this.attr(parts[1])
}
})
This splits the strings along single quotes, so for your example the array would be structured like this:
Good point.
What kind of feedback do these give you about any potential find and replace operations?
Using a scripting language you can output all manner of information to the terminal (such as which files will be affected, which lines your regex matched, or what the line looks like once the replace has been performed), as well as perform a dry-run. Is the same possible using Notepad++ for example?
What’s your OS?
The reason I ask is that Mac and Linux come with Ruby pre-installed, which would be advantageous if you were to go the scripting route.
With Atom for example, the potential matches are all marked by a line box around the text.
The find results across multiple files are also output to a separate log section, so that you can scan through them to check for any irregularities.