preg_replace('/(<p>[a-z]\).*<\/p>\s*<\/li>)/', '$1'."\n</ol>", $documento);
Explaining:
In the function preg_replace the first parameter is the regex that must start and end with bar / inside the regex it is necessary to escape the characters that have a special meaning in regex as ) and / in this case by adding an inverted bar before the character, s represents space characters/tab/new line etc, should be used in place of the n you placed, finally we put everything in parentheses () to create a group, because this part should continue after the replacement.
In the second parameter we put what will replace the selected text in regex, in which case we should keep the selected group in regex, to catch a group should use $ followed by the group number in ascending order starting with 1, and at the end concatenate the tag that will be added.
Thanks man, it worked!!!
– Alê Moraes