regex - How to use REGEXP in mysql for matching words from a text -


i have mysql query :

select name table_name name '%custom%' limit 10 

it retruns me 2 rows custom table.

i want records contains either of word text c cu cus cust usto stom tom om m also.

i tried below query :

select name table_name name '%custom%' or name regexp 'c|cu|cus|cust|usto|stom|tom|om|m' limit 10 

above query returning me 7 records these 7 records not have such 2 records 1st query result have.

how that? or other way these result in mysql?

edit : here want order maximum substrings matches in second query.

try this:

select name table_name name regexp 'custom' limit 10; 

there no need of like regexp, regexp slower like. if table have many records regexp quesries slower.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -