Download it now!
Bug 119728 - Unable to select multiple formats in find/search & replace
Summary: Unable to select multiple formats in find/search & replace
Status: RESOLVED DUPLICATE of bug 38261
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.5.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-06 13:38 UTC by William Friedman
Modified: 2018-09-29 17:30 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2018-09-06 13:38:00 UTC
Description:
Consider the following text:

<i>First Example.</i> First. Second. Third.

<i>Second Example</i>.   First. Second. Third.

<i>Third Example.    </i>First. Second. Third.

I wish to search for all periods followed by an arbitrary number of spaces following italicized text, and replace them with non-italicized colons and a single space, to produce the following text:

<i>First Example</i>: First. Second. Third.

<i>Second Example</i>: First. Second. Third.

<i>Third Example</i>: First. Second. Third.
 
The find regex for this is ([a-z])\. + and the replace is $1: . However, this only works if I could specify that only ([a-z]) should be in italics. It seems that LO is unable to do this. If I set the find field to Italics, then only the third example will be properly replaced. The second won't be found at all (since the period is not in italics) and the first will replace the period with a colon+space but retain the following space (since it's not in italics). On the other hand, if I omit searching for the italics, then it matches all text followed by a period, which results in erroneously replacing all other periods at the end of sentences with colons as well. So this search is impossible. There is a cumbersome three-step process to do it, but it should be doable in a single step.

Steps to Reproduce:
1. Enter the text as I described above.
2. Perform the search and replace as I described above.
3. See that it is impossible.

Actual Results:
Text that should be matched and replaced is not.

Expected Results:
All periods and an arbitrary number of spaces after italicized text should be replaced with a non-italicized colon and a single space.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Buovjaga 2018-09-29 17:30:32 UTC
Based on my quick test, it seems you will be able to do this with Alternative Find & Replace: https://extensions.libreoffice.org/extensions/alternative-dialog-find-replace-for-writer
As there exists a report asking for LibreOffice to match the features of the extension, I will close yours as duplicate.

Here is the help: http://mujweb.cz/macrojtb/HelpAltSearch_en.html

For your first example, I was able to solve it like so (Regular expressions enabled):
Find:
[:::CharPosture::]\.

Replace:
\A{CharPosture=0}:

So in the Find box, I clicked Properties and picked Italic and it gave me that [:::CharPosture::] extended regex.
Bonus: according to the help, if we want to search for non-italic (or non-something), we add a = sign, so it would be [:::CharPosture=::]

The period must be escaped with \ because we are using regular expressions.

In the Replace box, I clicked Pick properties and scrolled to the CharPosture = 0 entry. Then I just added the : after it.

*** This bug has been marked as a duplicate of bug 38261 ***