Skip to content

Instantly share code, notes, and snippets.

@christopherscott
Created September 6, 2012 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherscott/3657011 to your computer and use it in GitHub Desktop.
Save christopherscott/3657011 to your computer and use it in GitHub Desktop.
Grep through document source
(function() {
// change this REGEXP to whatever you need
var PATTERN = /<title>(.*)<\/title>/g;
var message = '',
results = document.documentElement.innerHTML.match(PATTERN);
message = ((results && results.length) ? results.join('\n') : 'Not found.');
window.alert(message);
})();
@christopherscott
Copy link
Author

the base; TODO: remove 'param' stuff, generalize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment