msyql searching a domain, without the TLD extension
15:47 22 Mar 2018

How can we search for a domain, without the TLD in mysql, so for e.g. testdomain.com, I would want to search only testdomain not the .com, so a search for test would return row, but a search for com would not.

I assume it would be similar to below with some regex, but no idea how to achieve that.

SELECT * FROM domains WHERE domain_name LIKE '%$search%'

Any idea on how to to search just that part of the domain?

mysql sql regex search