$re = '/3(?:\.\d+)*\.\s*/';
$str = '3.1. Cre
3.1.1. Im
3.1.1.1. O
3.1.1.2. Ce
3.1.1.3. Part
3.1.2. ED
3.1.2.1. Ow
3.1.2.2. ED
3.1.3. OF
3.1.3.1. O
3.1.3.2. O
3.1.3.3. O
3.1.3.4. O
3.1.4. Sc
3.1.5. In
3.1.6. Vi
3.1.7. Bu
3.1.8. Ho
3.1.8.1. Ou
3.1.8.2. In
3.1.9. Pa
3.1.9.1. Re
3.1.9.2. Re
3.1.9.3. Pr
3.1.9.3.1. Ou
3.1.9.3.2. Sp
3.1.9.3.3. In
3.1.9.3.4. In';
$subst = "\t";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php