ok, after I was confirmed by PM that there is no direct, single function way to do what I need, I solved the thing by myself, developing the paranoid fist idea I had (working with the exploded array with array search and replace) into this piece of code, maybe a little clumsy but effective... [code]// var setup $hist="a loto of text"; // this is the main text I need to parse to get my infos $inserie=0; // determinates if we have to consider the lines or not $in_string=" SERIE -"; // the word/flag in $hist from where what I'm interested in begins $out_string="^-"; // the word/flag in $hist from where what I'm interested in ends $serie=""; // a string the rebuild the "original" text portion $new_serie=""; // the ouptut string // the job // I explode the main text in an array line by line $work_serie=explode("\n", $hist); // print_r($work_serie); //debug // I use these debug lines to undesrtand where I get stuck foreach ($work_serie as $row_serie) { $row_serie=trim($row_serie); //cleanin up of data // determinates the array chunk where "recording" ends. It precedes the line that starts the recording because in my case, also starting line would match stop, causing no recording at all if (preg_match("/$out_string/", $row_serie) ) { $inserie=0; } // determinates the array chunk where "recording" begins. if (strpos($row_serie, $in_string)) { $inserie=1; } // the recording of data if ($inserie==1) { $serie .="$row_serie\r\n"; // This is the cleaned up data, rebuilt to it's original form $new_serie.="<b>$row_serie</b><br>"; // This is the worked out data. Final version will do some more str_replace and also some mysql querys } } // echo $new_serie; //debug // gets the final ouput $hist=str_replace($serie, $new_serie, $hist); [/code] My knowledge stops here, if someone knows how to improve it, any advice is welcome (and feel free to use it if you need.. ;)