#1
  1. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0

    Wild card for str_replace


    I have
    Code:
    $fileData1 = str_replace("2.0 &nbsp;Files Contained in Download<a", "", $fileData1);
    and
    Code:
    $fileData1 = str_replace("2.0&nbsp;Files Contained in Download", "", $fileData1);
    *NOTE the space after 2.0 in some files

    so I tried
    Code:
    $fileData1 = str_replace("2.0[^]+<a", "", $fileData1);
    and
    Code:
    $fileData1 = str_replace("2.0[^]*<a", "", $fileData1);
    How can I use a wildcard in str_replace?
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,756
    Rep Power
    9397
    You can't. str_replace() does only literal string replacement. No wildcards.
    Choose another function, or simply call str_replace() twice.
  4. #3
  5. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0
    Originally Posted by requinix
    You can't. str_replace() does only literal string replacement. No wildcards.
    Choose another function, or simply call str_replace() twice.
    Ok, thanks
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com

IMN logo majestic logo threadwatch logo seochat tools logo