Results 1 to 1 of 1
  1. #1
    Join Date
    Nov 2010
    Posts
    1

    Unanswered: Help matching best match (using REGEXP)

    Hi

    I have a table full of regexes (like the one bellow)

    part_match
    ^FF2
    ^FF2-0F4J
    ^FF2|FGD[12|21]FSFF

    I need a query to retrieve the part_match of the BEST match for 'FF2-0F4J-YJKNC'

    I tried going 'FF2-0F4J-YJKNC' regexp match_match ORDER BY length( part_match ) DESC and grab the first row returned, but will not work because this will return row 3 first but the best match is row

    Does any one know how to solve this problem by only using a MYSQL query?

    Note
    Obviously this is an example, the actual table is huge and I need something works for any input


    Thank you !!
    Last edited by mc_line; 11-24-10 at 15:53.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •