0

I'm using a javascript regex to extract the keyword from a Google search. ( Extract keyword from Google search in Javascript )

The answer from the previous post works great except some cases when you do several searches in a row

i.e. I searched for the keyword "car" and I got some results, then I did another search for the keyword "plane" and I got the url ( http://www.google.com/search?q=car&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a#sclient=psy&hl=en&client=firefox-a&hs=P4M&rls=org.mozilla:fr%3Aofficial&source=hp&q=plane&aq=f&aq... ). For this search I get the keyword "car" and then the keyword "plane" and what I'd like is only the last keyword ("plane").

Does someone know how to correct the regex from the previous to make it work ?

Community
  • 1
  • 1
Bruno
  • 8,497
  • 13
  • 38
  • 55

1 Answers1

0

JavaScript from the post you mentioned works fine for me and only returns "plane", see here: http://jsfiddle.net/EWx4S/

Ruslan
  • 9,927
  • 15
  • 55
  • 89