fork download
  1. <?php
  2. $str = 'text text text [COLOR="DarkGreen"]*sgeeg[/COLOR] text<br/>[COLOR="DarkGreen"]*affafaf[/COLOR]
  3. text[COLOR="Red"]*sgseg[/COLOR] text :&[COLOR="Red"]*drgdog[/COLOR]';
  4.  
  5. preg_match_all('/\[COLOR="DarkGreen"[^]]*\](.*?)\[\/COLOR\]/',$str, $matches);
  6. print_r($matches[1]);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => *sgeeg
    [1] => *affafaf
)