I need to grab data from this text from this page:
http://www.chess.com/home/game_archive?sortby=&show=echess&member=deckers1066
I cannot seem to get it working using.
var text = document.body;
var results = text.match(/id=[0-9]*>/g);
I need to grab all occurrences that look something like this
/echess/game?id=60942234
I’m interested more in the id number
You’ve got two problems with your code; one is the string you want to search is
document.body.innerHTMLand the other is the RegExp is looking for the end tag to the element,>without a quote before it. Try thisNote I completely ommited the end tag because this RegExp is greedy and it means you don’t have to worry about HTML parsing.