I have data like this in a longtext column:
Name: Adam Smith
Name: Bob Johnson
Name: John Hansen
Is it possible to use a wildcard, within regexp? Say a user searches Smith, in pseudo-code:
SELECT * FROM mytable
WHERE `file` REGEXP 'Name: %Smith%\n'
I’m pretty sure the % wildcard isn’t a function within regexp. Is it possible to do this?
The
REGEXP-using answer is:However
LIKEis more suitable: