SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    str replace problem

    I am trying to do a very simple replace to replace all instances of $ with \$ in a string.

    But it dosen't want to work, i get this:

    Warning: REG_BADRPT:nrepetition-operator operand invalid in g:\nusphere\nusphere\apache\htdocs\deskpro\admin\template_download.php on line 59


    any ideas?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you show us the actual code, I think you are probably just not escaping them right. Your str_replace() line should look like

    $str = str_replace("\$", "\\$", $str);
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "doh" thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •