MySQL cross table regular expression match
Posted
by Josef Sábl
on Stack Overflow
See other posts from Stack Overflow
or by Josef Sábl
Published on 2010-06-03T08:43:17Z
Indexed on
2010/06/03
8:54 UTC
Read the original article
Hit count: 267
I have a web application and I am working on engine that analyzes referals.
Now I have table with pageviews along with referes that looks something like this:
pv_id referer
------------------------------------------------------------
5531854534 http://www.google.com/search?ie=UTF-8...
8161876343 http://google.cn/search?search=human+rights
8468434831 http://search.yahoo.com/search;_...
The second table contains sources definitions like:
source regex
------------------------------------------------------------
Google ^https?:\/\/[^\/]*google\.([a-z]{2,4})(\/.*|)$
Yahoo ^https?:\/\/[^\/]*yahoo\.com(\/.*|)$
What I want is third table created by joinin these two:
pv_id source
------------------------------------------------------------
5531854534 Google
8161876343 Google
8468434831 Yahoo
How to join these tables with regular expression?
© Stack Overflow or respective owner