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

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0

    Collapse 2 str_repace stmts with wildcard


    Code:
    $fileData1 = str_replace("<FONT face='Arial' size='3'>", "", $fileData1);
    $fileData1 = str_replace("<FONT face='Courier' size='3'>", "", $fileData1);
    I'm not getting the wildcard syntax to collapse these 2 stmts into 1:
    Code:
    $fileData1 = str_replace("<FONT face='[^'*] size='\d+'>", "", $fileData1);
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,245
    Rep Power
    9400
    * applies to the previous thing in most cases. It does not when you use it in a character set: there it means a literal asterisk.
    Code:
    '[^']*'
  4. #3
  5. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0
    Sweet!
    Thanks for the syntax help
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2007
    Posts
    1,513
    Rep Power
    1424
    In str_replace()? Really?

    I'd rather use preg_replace() for that purpose...

    Regards, Jens

    Comments on this post

    • requinix agrees : ...oh jeez, I missed that? :(

IMN logo majestic logo threadwatch logo seochat tools logo