1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development php expression problems

Discussion in 'Software' started by Fusen, 21 Jul 2005.

  1. Fusen

    Fusen New Member

    Joined:
    17 Jan 2004
    Posts:
    351
    Likes Received:
    0
    trying to get this working;

    Code:
    <?php
    $old = "[45/43]"; 
    $new = preg_replace('\[[0-9][0-9]\/[0-9][0-9]\]', 'removed', $old); 
    echo "result $new";
     ?>
    
    but all its showing is "result"

    I need it to get rid of text that is being outputted as [number/number] sometimes the nubmer is double figure sometimes its single

    any help would be appreciated
     
  2. Hwulex

    Hwulex New Member

    Joined:
    1 Feb 2002
    Posts:
    4,007
    Likes Received:
    1
    So, you're trying to remove the whole thing "[XX/XX]", right?

    PHP:
    echo preg_replace('/[[0-9]+\/[0-9]+]/''removed'$old);
    // echos "result removed"
     
  3. Fusen

    Fusen New Member

    Joined:
    17 Jan 2004
    Posts:
    351
    Likes Received:
    0
    thanks hwulex working perfectly
     

Share This Page