I'm having trouble writing the regular expression to do what I need in MySQL syntax.
I have the following value for column http_referer in a database table:
https://www.example.com?id=123&true
And I need to return the value of the query string parameter uid (in this case, 123), to plug in to another query.
`SELECT * FROM sites WHERE id = (http_referer REGEXP 'uid=([0-9]+)&?')
This is my query, that doesn't work, probably because I'm trying to pass in a PHP-style regular expression instead of one MySQL can use (however, I understand that MySQL doesn't even support capture groups, so I'm kind of stumped).
[0-9+]means match a single character which is either a digit 0 to 9 or the plus sign. You probably want to move the quantifier (+) outside the character group:[0-9]+. AlsoWHERE id = (...)doesn't look right.