I would like to know how to use MySQL’s REGEXP or RLIKE feature for the two following tasks:
Task #1
Select all e-mail addresses, but only return the component after the @ and before the first . in the domain. So say I had 3 emails in a table… bob@123.com, bill@456.com, ben@789.com I would just want it to return 3 results of 123, 456, 789.
Task #2
When used in a WHERE clause, I would like to only match where the same part of the domain (after the @ and before the first .) meets a certain criteria. For arguments sake, lets say this is 123, 456 or 789.
Task #1 – there is no way to do this, MySQL can use REGEXPS only for comparision
Task #2 –