mysql regular expression condition to identify Android Tablet from useragent
I have useragent information in mysql table, I would like to extract only
the "Android Tablet" rows alone,
I have found the regex pattern to match "Android Tablet" from
https://developers.google.com/chrome/mobile/docs/user-agent, ie.,
'Android' + 'Chrome/[.0-9]* (?!Mobile)'
Initially i have tried with below query
SELECT * FROM table_page_views WHERE user_agent REGEXP 'Android' +
'Chrome/[.0-9]* (?!Mobile)';
which was returning all results, without filtering any condition.
Then i have modified as below queries,
SELECT * FROM table_page_views WHERE user_agent REGEXP 'Android +
Chrome/[.0-9]* (?!Mobile)';
SELECT * FROM table_page_views WHERE user_agent REGEXP '\'Android\' +
\'Chrome/[.0-9]* (?!Mobile)\''
For these queries, I have got an error, saying
SQL Error (1139): Got error 'repetition-operator operand invalid' from regexp
So, I would like to have a filtering condition from the above given
pattern so, that I can identify the rows of useragent "Android tablet"
Thank you!
No comments:
Post a Comment