Jump to content

Torrodon

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Torrodon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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]
  4. Thank you that was exactly what i needed
  5. How to make my regexp to catch the following strings: but not to catch the following: to catch the first 3 strings i tried this: Unfortunately it catches the second one too. I cannot figure it how to replace .+ so <br /> (or any other tag) to pass except </a> tag.
  6. grrr i forgot '-' is special symbol inside [] and i have to escape it preg_match_all ( '/[^a-z0-9_ \-&]/i' , $string , $matches ); this should work i'm going to test it now thanks
  7. I need to match all symbols except letters, numbers, "_", " ", "-", "&"? I tried the following but it is not working: preg_match_all ( '/[^a-z0-9_ -&]/i' , $string , $matches );
×
×
  • 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.