Jump to content

Torrodon

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by Torrodon

  1. If I have something like select * from `table` where `desc` like '%test.com%' Is there a way to search for exact string "test.com", not the pattern "test.com", so the dot is dot and not any char and so?
  2. Thank you, @sasa Now after you mentioned it i found this exception in the documentation. (http://php.net/manual/en/function.preg-replace.php) I've also found my second mistake - the solution does not work with double quotes. So finally this is working: $new_str_1 = preg_replace($pattern,'${1}'.$newcolor.'$3',$str); Too bad this is unlikely to help anyone else due to my poor description.
  3. I'm trying to replace a color in css file using preg_replace. First i have tried to replace part of pattern using $1 and $3, but it didn't work. Next i have extracted the pattern into $matches array, replaced one of them and combined them as new replace string. It worked as expected. I think there is difference how parts of pattern defined by () are matched by preg_match->$matches_array and preg_replace->$1,$2,$3... I know my explanation of the problem is not good at all so i'm attaching very simple php file (zipped) that show the error. Can someone help me understand what i'm doing wrong? [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.