Case insensitive search.

Discussion in 'PHP' started by Mike, Aug 22, 2005.

  1. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
    I have implemented a regular expression search system where preg_match() search a particular word in file. The problem with this fuunction is it is case sensative that is it searches when exact case is found,but not the exact word for example preg_match(). what is the solution?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    In the preg_match function to create a regular expression that is case insensitive you just need to add "/i" and that should do the job. You can refer the following thread for complete details
    Mastering Regular Expression
     
  3. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    39
    Trophy Points:
    28
    preg_match uses perl compatible regular expression.
     
  4. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
    Thanks. that solved my problem.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice