Jump to content



Recommended Posts

I know most of this issue is me not knowing how to use SIMILAR TO and regex so any help would be great.


I am trying to match a product title entered into a search field with titles already in a database.


for example in the database the title is "Robocop"


when I look up another title say ... "Robocop Blu-Ray" or "Robocop (The Criterion Collection)" or "Prime Directives Robocop Series"


how can I get it to return a match?


Thanks in advance.


Link to comment
Share on other sites

  • 5 months later...

Sounds like you can get away with a simple LIKE statement:


WHERE title LIKE '%' || your_string_here || '%'


The % signs are wildcards and the || signs append the who thing together to become '%Robocop%'


Note however that LIKE statements that start with a wildcard can be very slow because the database cannot use indexes to eliminate records that cannot possibly match.

FULLTEXT may be a better solution, but is (a little) more complex to setup

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.