Skip to content

Instantly share code, notes, and snippets.

@missinglink
Last active April 15, 2021 14:05
Show Gist options
  • Select an option

  • Save missinglink/6377561 to your computer and use it in GitHub Desktop.

Select an option

Save missinglink/6377561 to your computer and use it in GitHub Desktop.
Extract price information from any page using regex stolen from this annoying superfish script.
var regexp = /(([\$\£\€\u20AC]|eur|ils|rs)\.?\s*(<[^>]+>|&nbsp;|\s)?([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)|(([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)(<[^>]+>|&nbsp;|\s|\s\,\-\s)?(€|\u20AC|eur|ils|rs)\.?/ig;
document.body.innerHTML.match(regexp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment