user2783755
user2783755

Reputation: 588

Regex in MySql database

sorry for my English.
Please help with pregex in MySql. I want to find two words in text. Between this words can be one or more spaces and/or punctuation mark.
For example:

Tree, apple
Tree   ,   apple
Tree     ,apple
Tree   ,apple
Tree,apple

Thanks you!

Upvotes: 1

Views: 66

Answers (1)

Drew Noel
Drew Noel

Reputation: 86

MySQL natively supports RegEx since 5.1. Are you looking for something like:

SELECT * FROM `mytable` WHERE `mycol` REGEXP '[[:alpha:]]+[ ,.]*[[:alpha:]]+'

For more information, check out the MySQL Documentation

Upvotes: 2

Related Questions