fork download
  1. <?php
  2.  
  3. $re = '~/\*[^*]*\*+(?:[^/*][^*]*\*+)*/(*SKIP)(*F)|^\s*([^=\n]+?)\s*=\s*(.*?);\h*(?:$|\r?\n)~sm';
  4. $str = "/*\nanything description\n*/\n\nData1 = value1;\n\nOtherData<> = Other Value;\n\n/*\nmy other description\n*/\n\nAny thing = Any \nAnswer;\n\n/*\n\nthis is description and must not detect\n\nDescription_Data = Any_Value;\n\n*/";
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches[1]);
  7. print_r($matches[2]);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Data1
    [1] => OtherData<>
    [2] => Any thing
)
Array
(
    [0] => value1
    [1] => Other Value
    [2] => Any 
Answer
)