Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: MySQL regexp question

    Hello, there!

    I have such question. I have a number of string type fields in a MysQL table. I'd like to test such approach. When I form a query for this table I need to find all of search words in few fields (ie, they named ProgramName, ProgramDescr, CompanyName). I need to use MySQL regular expressions and I need to get such result: I need to form something like that:
    select * from table1
    where (((ProgramName like '%keyword1%') and
     (ProgramName like '%keyword2%') and 
    (ProgramName like '%keyword3%')) or 
    ((CompanyName like '%keyword1%') and 
    (CompanyName like '%keyword2%') and 
    (CompanyName like '%keyword3%')) or 
    ((ProgramDescr like '%keyword1%') and 
    (ProgramDescr like '%keyword2%') and 
    (ProgramDescr like '%keyword3%')))
    but using MySQL ergexp. I need to form a query condition more universal.

    By the way, will be such approach (using regular expressions) faster than "like" using?

    Thanks for any suggestions in advance.
    Last edited by khibinite; 11-22-03 at 10:15.

  2. #2
    Join Date
    Oct 2003
    To be more understandable, I'd like to get the next:
    I need to compose such regexp condition taking a comparison with "AND": ProgramName = (keyword1 AND keyword2 AND keyword3).

    Hope you get all I meant .

Posting Permissions

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