[Solved] Regex for replacing Hard Page Break

Discuss the word processor
Post Reply
victusinambitus
Posts: 10
Joined: Thu Nov 20, 2014 9:33 am

[Solved] Regex for replacing Hard Page Break

Post by victusinambitus »

Hi
What is the Regex command for a Hard Page Break (inserted with CTRL+Enter)? I wish to Find & Replace and in online and F1 help I can find reference to $ and \n for Paragraphs but not Page Breaks.
Thank you
Last edited by victusinambitus on Thu Dec 14, 2017 10:04 pm, edited 1 time in total.
OpenOffice 4.1 on Windows Vista
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Regex for Hard Page Break

Post by Zizi64 »

Similar topic, and useful information about the Page Break:

viewtopic.php?f=7&t=5110
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
victusinambitus
Posts: 10
Joined: Thu Nov 20, 2014 9:33 am

Re: Regex for Hard Page Break

Post by victusinambitus »

So it cannot be done.
CTRL+Enter [Hard Page Break] is "not a character, it's a property of the paragraph and cannot easily replaced". https://bz.apache.org/ooo/show_bug.cgi?id=26719
That sux!
H/T: http://www.oooninja.com/2007/12/example ... riter.html
OpenOffice 4.1 on Windows Vista
User avatar
Hagar Delest
Moderator
Posts: 32665
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Regex for Hard Page Break

Post by Hagar Delest »

I think that Altsearch does the job: Alternative dialog Find & Replace for Writer (AltSearch).

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the edit button if your issue has been fixed.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
victusinambitus
Posts: 10
Joined: Thu Nov 20, 2014 9:33 am

Re: Regex for Hard Page Break

Post by victusinambitus »

No, sorry Hagar - it says that it will Find & Replace the Manual Page Break but it doesn't. Version 1.4.2 3/2017 uses the regex code [\m] for a Manual Page Break and it is in the list of options on a drop-down. Attempting to replace with a single character though, e.g. [~] leaves the Manual Page Break there in the document and inserts the [~] after the Manual Page Break. This is better in that using AltSearch I can now identify where the Manual Page Breaks occur but it still does not actually replace them. I also noted that searching for multiple instances [/m/m/m] also return positives when there were only single Manual Page Breaks - so . . . a little buggy this plugin!
Thank you for helping nonetheless.
OpenOffice 4.1 on Windows Vista
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Regex for Hard Page Break

Post by Zizi64 »

The AltSearch works fine for me in my LibreOffice 5.3.7. In had use
\m in the "search for" field, and
\r in the "replace" field.

All of the manual page breaks are replaced by this method from my ODF type sample document.

The version of the AltSearch extension: 1.4.2
AltSearch.png

The Page Breaks was applied by a simple Ctrl-Enter (read: without applying a new page style)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
victusinambitus
Posts: 10
Joined: Thu Nov 20, 2014 9:33 am

Re: Regex for Hard Page Break

Post by victusinambitus »

OK I have followed your advice - thank you - and the solution you have proposed works.
Resolved
The secret is to replace \m with \r NOT attempt to replace it with another character in its own right. The two bugs mentioned above remain though (Oo 4.1.2).
For people wanting to REPLACE A HARD PAGE BREAK IN OPENOFFICE - you need to follow Zizi64's instructions - simply replace \m with \r using AltSearch - good as gold!
OpenOffice 4.1 on Windows Vista
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Resolved] Regex for replacing Hard Page Break

Post by Zizi64 »

The code \r means: "Dissolve manual page or column break". You can chose it from the dropdown list.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply