Skip to content

Instantly share code, notes, and snippets.

@trico
Created May 30, 2011 22:34
Show Gist options
  • Save trico/999587 to your computer and use it in GitHub Desktop.
Save trico/999587 to your computer and use it in GitHub Desktop.
Expresión regular para obtener intereses
var re = /%interes%&i=([a-z0-9A-Z]*)&u=(\S*)/g,
text = 'href="%interes%&i=SoyUnInteres&u=http://google.es/?%moglaA2%20 texto sobre el texto de textos a mas textos %Q /ht href="%interes%&i=OtroInteres&u=http://popplers.com"',
matched = null;
while( (matched=re.exec(text)) != null )
console.log(matched[1] + ' = ' + matched[2].replace('"', ''));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment