I just tried the exact same regexp replacement in OpenOffice 3.4.1, which has the same new regexp engine as LibO 4.0. I got the same strange result. In fact, italics were removed from the whole quotation. There are known bugs in this new ICU engine; the AOO developers are aware of it:
The bug is marked as “Resolved Fixed” with a target milestone of AOO 4.0, which means it will take some time for the fix to actually appear in a release version. Now I hope that the fix will be in the next feature release of LibO.
On a side note, the new regexp engine is, as far as I know, not yet properly documented in the official AOO and LibO documentation. Here is the ICU regexp guide. This guide unfortunately has three major issues:
- It is heavily developer-oriented, though the metacharacters and operators lists are useful for users;
- It is incomplete and has many spelling/language errors;
- The HTML document itself is the worst kind of non-standard, invalid,
<font>
tag-laden atrocity I have ever come across on the Web. It is ridiculous. How can C++/Java developers fail so badly at producing adequate and well-formed documentation?
So for now, refer to the user-destined lists and tables in the guide, but do not even try to make sense of the HTML. Eventually, the AOO and LibO documentations should have an updated, sensible and clean guide that fully documents this new engine. The ICU project should also clean up their mess, but that is another story.
Edit: This just came back to me and it is very important for the current case. Regular expressions are not needed to replace quotes and apostrophes! The AutoCorrect function exists for exactly that kind of scenario. “Format > AutoCorrect > AutoCorrect Options…” allows you to define replacements for various characters, among which quotation marks, and decide what they will be replaced with. The correction can be applied automatically during typing, but can also be applied afterwards with “Format > AutoCorrect > Apply”. The AutoCorrect Options dialog has many options; adding the desired definitions for all replacements makes the tool very powerful and versatile.