PHP preg_replace Help

Discussion in 'PHP' started by easywab, Jul 4, 2008.

  1. #1
    Hi,

    I'm trying to solve this for hours.. Pls. give me the solution if you can..

    I need to remove all the characters with in brackets..

    Eg ,

    Newyork (NY) USA should be Newyork USA

    abcd (rrr) abc => abcd abc

    Pls. let me know a way to do this using php preg_replace.

    Thanks in advance...
     
    easywab, Jul 4, 2008 IP
  2. jmf000

    jmf000 Peon

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $newstr = preg_replace('/\s*\([^\)]*\)\s*/',' ',$str);
     
    jmf000, Jul 4, 2008 IP
  3. easywab

    easywab Peon

    Messages:
    262
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's Working .. Thanks jmf000.. :)
     
    easywab, Jul 4, 2008 IP