Help with find & replace.

I am looking for a find & replace solution in Writer, where there is a
blank space as the last character of a paragraph
(eg. last word <space><LF><CR>).

In the original OOo and most of the text editors I use the simple
solution that worked/works perfectly is:
Find = <space>$ Replace = $
(Note: I use <space> here to represent a single space character).

This does not work in LO Writer, so I am forced to fiddle around copying
from LO and pasting into AOO, running F&R in AOO, then copy/paste back
again.

Any pointers would be welcome.

Dave

I'm surprised that exactly what you say works in OpenOffice. Don't you need to find space-dollar, just as you describe, but to replace with nothing? Replacing with dollar will surely insert an unwanted dollar character?

Or have you forgotten to click "Other options" in the Find and Replace dialogue and to tick "Regular expressions"?

I trust this helps.

Brian Barker

I am looking for a find & replace solution in Writer, where there is a
blank space as the last character of a paragraph
(eg. last word <space><LF><CR>).

I think ␊␍ is Windows only, but maybe that doesn't matter in this case.

In the original OOo and most of the text editors I use the simple
solution that worked/works perfectly is:
Find = <space>$ Replace = $
(Note: I use <space> here to represent a single space character).

This does not work in LO Writer, so I am forced to fiddle around copying
from LO and pasting into AOO, running F&R in AOO, then copy/paste back
again.

It works perfectly for me. It replaces the space with a $ character, just
like expected (make sure ”☒ Regular expressions” is checked). If you don't
want the $ character, then just leave the Replace field empty.
I tried it a few seconds ago with LibreOffice 7.1.8.1 and it worked
perfectly. I suspect it works just as well with newer versions as well as
most older versions too.

In LibreOffice, the $ character doesn't mean a ”new line character”, it
doesn't work quite like that. A paragraph is kind of an object which
contains the actual text and all the properties of that paragraph (as far
as I understand it), so <space>$ doesn't really mean ”a space followed by a
newline character”, it rather means ”a space at the end of a paragraph”. It
just specifies where to look for the space, nothing more. So you are not
replacing two characters with one, you are replacing one character with
nothing and you are doing it at the end of a paragraph.

At least that's the easiest way I can explain it.

I hope this helps.

Are you sure that replacing with $ actually worked in Apache OpenOffice?
I'm not sure, but it shouldn't, should it? Because Apache OpenOffice works
the same way as LibreOffice in this matter, working with objects and all
that. As I no longer have Apache OpenOffice installed I can't test it, so I
can't say for sure.

Kind regards

Johnny Rosenberg

[:space:]{1,}$ Seemed to work for me in find option and
left replace completely blank. Than replace all.

<users@global.libreoffice.org>
Date sent: Wed, 16 Mar 2022 16:29:34 +0000

Hi Brian,

After 22 Years of you and I being involved in this project, I genuinely
bow to your superior knowledge in this area. However, I do assure you
that the convoluted LO->AOO->LO nonsense works for me, exactly as it
did in the days of OOo.

No, I have not forgotten to click "Other options in the Find and Replace
dialogue and to tick "Regular expressions", please see my screen capture:
https://www.mediafire.com/view/80552jkp3qw6o8x/F%26R_LO.png/file

Here is a very simplistic file illustrating the <space><CR><LF>
paragraph endings:
https://www.mediafire.com/file/vmixa9r4dhjpc9e/F%26R_LO.odt/file

Version: 7.3.1.3 (x64) / LibreOffice Community
Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: es-ES (en_IE); UI: en-US
Calc: threaded

If you can please show me where I am going wrong, I would be extremely
grateful.

Dave Barton

May be this is sorted and I have received the emails out of order, but assuming you just want to remove the trailing space from each line, both Johnny's and Michael's methods work for me on your sample file.

Find= [:space:]{1,}$
Replace= empty

Find= <space>$
Replace= empty

Use regular expression= checked
Steve

Date sent: Thu, 17 Mar 2022 09:01:42 +1300
replace.
<steve.edmonds@ptglobal.com>

>>> I am looking for a find & replace solution in Writer, where there is a
>>> blank space as the last character of a paragraph (eg. last word
>>> <space><LF><CR>). In the original OOo and most of the text editors I
>>> use the simple solution that worked/works perfectly is: Find =
>>> <space>$ Replace = $ (Note: I use <space> here to represent a single
>>> space character). This does not work in LO Writer, so I am forced to
>>> fiddle around copying from LO and pasting into AOO, running F&R in
>>> AOO, then copy/paste back again. Any pointers would be welcome.
>> I'm surprised that exactly what you say works in OpenOffice. Don't you
>> need to find space-dollar, just as you describe, but to replace with
>> nothing? Replacing with dollar will surely insert an unwanted dollar
>> character?
>>
>> Or have you forgotten to click "Other options" in the Find and Replace
>> dialogue and to tick "Regular expressions"?
>>
>> I trust this helps.
>>
>> Brian Barker
> Hi Brian,
>
> After 22 Years of you and I being involved in this project, I genuinely
> bow to your superior knowledge in this area. However, I do assure you
> that the convoluted LO->AOO->LO nonsense works for me, exactly as it
> did in the days of OOo.
>
> No, I have not forgotten to click "Other options in the Find and Replace
> dialogue and to tick "Regular expressions", please see my screen capture:
> https://www.mediafire.com/view/80552jkp3qw6o8x/F%26R_LO.png/file
>
> Here is a very simplistic file illustrating the <space><CR><LF>
> paragraph endings:
> https://www.mediafire.com/file/vmixa9r4dhjpc9e/F%26R_LO.odt/file
>
> Version: 7.3.1.3 (x64) / LibreOffice Community
> Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
> CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
> Locale: es-ES (en_IE); UI: en-US
> Calc: threaded
>
> If you can please show me where I am going wrong, I would be extremely
> grateful.
>
> Dave Barton
>
>
May be this is sorted and I have received the emails out of order, but
assuming you just want to remove the trailing space from each line, both
Johnny's and Michael's methods work for me on your sample file.

Find= [:space:]{1,}$
Replace= empty

Find= <space>$
Replace= empty

Use regular expression= checked
Steve

Just to make sure it is clear <space>$ will only remove 1
space at end of line <space>{1,}$ or [:space:]{1,}$ will
remove all spaces 1 to whatever.

Thanks Steve, but no it's NOT sorted.

You have "Kinda" given me 1/2 a clue.

What does {.1.} mean?

In all my researching of regular expressions, I have never encountered
this option. The wonderful thing about *_STANDARDS_* is that there are
such a wide variety of different ones to randomly chose and use.

Dave

replace.
Date sent: Wed, 16 Mar 2022 20:41:43 +0000

>
>
>>>> I am looking for a find & replace solution in Writer, where there is a
>>>> blank space as the last character of a paragraph (eg. last word
>>>> <space><LF><CR>). In the original OOo and most of the text editors I
>>>> use the simple solution that worked/works perfectly is: Find =
>>>> <space>$ Replace = $ (Note: I use <space> here to represent a single
>>>> space character). This does not work in LO Writer, so I am forced to
>>>> fiddle around copying from LO and pasting into AOO, running F&R in
>>>> AOO, then copy/paste back again. Any pointers would be welcome.
>>> I'm surprised that exactly what you say works in OpenOffice. Don't you
>>> need to find space-dollar, just as you describe, but to replace with
>>> nothing? Replacing with dollar will surely insert an unwanted dollar
>>> character?
>>>
>>> Or have you forgotten to click "Other options" in the Find and Replace
>>> dialogue and to tick "Regular expressions"?
>>>
>>> I trust this helps.
>>>
>>> Brian Barker
>> Hi Brian,
>>
>> After 22 Years of you and I being involved in this project, I genuinely
>> bow to your superior knowledge in this area. However, I do assure you
>> that the convoluted LO->AOO->LO  nonsense works for me, exactly as it
>> did in the days of OOo.
>>
>> No, I have not forgotten to click "Other options in the Find and Replace
>> dialogue and to tick "Regular expressions", please see my screen capture:
>> https://www.mediafire.com/view/80552jkp3qw6o8x/F%26R_LO.png/file
>>
>> Here is a very simplistic file illustrating the <space><CR><LF>
>> paragraph endings:
>> https://www.mediafire.com/file/vmixa9r4dhjpc9e/F%26R_LO.odt/file
>>
>> Version: 7.3.1.3 (x64) / LibreOffice Community
>> Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
>> CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL:
>> win
>> Locale: es-ES (en_IE); UI: en-US
>> Calc: threaded
>>
>> If you can please show me where I am going wrong, I would be extremely
>> grateful.
>>
>> Dave Barton
>>
>>
> May be this is sorted and I have received the emails out of order, but
> assuming you just want to remove the trailing space from each line, both
> Johnny's and Michael's methods work for me on your sample file.
>
> Find= [:space:]{1,}$
> Replace= empty
>
> Find= <space>$
> Replace= empty
>
> Use regular expression= checked
> Steve

Thanks Steve, but no it's NOT sorted.

You have "Kinda" given me 1/2 a clue.

What does {.1.} mean?

file:///opt/libreoffice7.3/help/en-US/text/shared/01/02100001.html?&DbPAR=WRITER

{N}

The post-fix repetition operator that specifies an exact
number of occurrences ("N") of the regular expression
term immediately preceding it must be present for a
match to occur. For example, "tre{2}" matches "tree".

{N,M}
The post-fix repetition operator that specifies a range
(minimum of "N" to a maximum of "M") of occurrences of
the regular expression term immediately preceding it
that can be present for a match to occur. For example,
"tre{1,2}" matches "tre" and "tree".

{N,}
  
The post-fix repetition operator that specifies a range
(minimum "N" to an unspecified maximum) of
occurrences of the regular expression term immediately
preceding it that can be present for a match to occur.
(The maximum number of occurrences is limited only by
the size of the document). For example, "tre{2,}"
matches "tree", "treee", and "treeeee".

So, [:space:]{1,}$ matches one or more spaces at end of
line.
<space>{1,}$ does the same with <space> actually
being a single space.

>
>
>>>> I am looking for a find & replace solution in Writer, where there is a
>>>> blank space as the last character of a paragraph (eg. last word
>>>> <space><LF><CR>). In the original OOo and most of the text editors I
>>>> use the simple solution that worked/works perfectly is: Find =
>>>> <space>$ Replace = $ (Note: I use <space> here to represent a single
>>>> space character). This does not work in LO Writer, so I am forced to
>>>> fiddle around copying from LO and pasting into AOO, running F&R in
>>>> AOO, then copy/paste back again. Any pointers would be welcome.
>>> I'm surprised that exactly what you say works in OpenOffice. Don't you
>>> need to find space-dollar, just as you describe, but to replace with
>>> nothing? Replacing with dollar will surely insert an unwanted dollar
>>> character?
>>>
>>> Or have you forgotten to click "Other options" in the Find and Replace
>>> dialogue and to tick "Regular expressions"?
>>>
>>> I trust this helps.
>>>
>>> Brian Barker
>> Hi Brian,
>>
>> After 22 Years of you and I being involved in this project, I genuinely
>> bow to your superior knowledge in this area. However, I do assure you
>> that the convoluted LO->AOO->LO nonsense works for me, exactly as it
>> did in the days of OOo.
>>
>> No, I have not forgotten to click "Other options in the Find and Replace
>> dialogue and to tick "Regular expressions", please see my screen
capture:
>> https://www.mediafire.com/view/80552jkp3qw6o8x/F%26R_LO.png/file
>>
>> Here is a very simplistic file illustrating the <space><CR><LF>
>> paragraph endings:
>> https://www.mediafire.com/file/vmixa9r4dhjpc9e/F%26R_LO.odt/file
>>
>> Version: 7.3.1.3 (x64) / LibreOffice Community
>> Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
>> CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL:
>> win
>> Locale: es-ES (en_IE); UI: en-US
>> Calc: threaded
>>
>> If you can please show me where I am going wrong, I would be extremely
>> grateful.
>>
>> Dave Barton
>>
>>
> May be this is sorted and I have received the emails out of order, but
> assuming you just want to remove the trailing space from each line, both
> Johnny's and Michael's methods work for me on your sample file.
>
> Find= [:space:]{1,}$
> Replace= empty
>
> Find= <space>$
> Replace= empty
>
> Use regular expression= checked
> Steve

Thanks Steve, but no it's NOT sorted.

You have "Kinda" given me 1/2 a clue.

What does {.1.} mean?

It means ”one or more of the previous character”. Well, it's {1,}, not
{.1.}.
You can also specify a maximum value, like this: {1,5}. This means ”at
least one and not more than 5 of the previous character.
For instance:
[0-9]{3,5}
This means at least three and not more than 5 numerical characters.

Kind regards

Johnny Rosenberg

Fantastic, but why does the LO project *_NOT_* inform it's users about
this *_HIDDEN_* option?

Please provide links to the the TDF/LO Help/Documentation files that
provide this information to our users.

I just looked at LibreOffice help, searched for Regular Expressions,
selected the list of regular expressions, and found all of the info you are
looking for..

Hi jomali,

Would you care to elaborate and provide links?

Dave

Dave, *

LibreOffice uses the ICU Regular Expression libraries. Full documentation is here:

https://unicode-org.github.io/icu/userguide/strings/regexp.html

While the projects documentation for its use is here:

https://help.libreoffice.org/7.3/en-US/text/shared/01/02100001.html

https://help.libreoffice.org/latest/bs/text/swriter/guide/search_regexp.html

There have been a number of tweaks for handling new line/end of para that you can track in Bugzilla.

Stuart

Thanks to all who replied.

Dave

replace. [SOLVED]
Date sent: Thu, 17 Mar 2022 09:49:41 +0000

> I am looking for a find & replace solution in Writer, where there is a
> blank space as the last character of a paragraph
> (eg. last word <space><LF><CR>).

Thanks to all who replied.

No problem. That is what support lists are suppose to do.
Glad you got a solution.