In awstats I get a table with all the key words and phrases used to find my website. I would like to capture this myself however each search engine url is in a different format
I am having to add to it all the time, but here is a REGEX that should strip out the keywords from google, yahoo, bing, ask, and MSN (same as Bing). It leaves the + in between, but it should be a good place for you to start:
.*(\?p=|\?q=|&q=|\?s=)([a-zA-Z0-9 +]*)(&toggle=|&ie=utf-8|&FORM=|&aq=|&x=|&gwp).