[Solved] Replacing paragraph mark..

Discuss the word processor

[Solved] Replacing paragraph mark..

Postby maya90 » Wed Jul 30, 2008 6:37 pm

hi,

how do you replace paragraph marks, tabs, etc.. in Open Office Writer? (in MS Word, you would type, for example, ^p for paragraph mark, but this is not working in Open Office.. how do you do this in OO pls..) thank you very much..
Last edited by Hagar Delest on Thu May 26, 2011 8:22 am, edited 1 time in total.
Reason: tagged [Solved].
OOo 2.4.X on MS Windows Vista
maya90
 
Posts: 3
Joined: Wed Jul 30, 2008 6:28 pm

Re: replacing paragraph mark..

Postby acknak » Wed Jul 30, 2008 7:37 pm

OOo uses a far more powerful (but also far more complicated, and at the same time less complete) feature:
Regular Expressions in Writer [OOo wiki]
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 19476
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: replacing paragraph mark..

Postby r4zoli » Wed Jul 30, 2008 7:46 pm

Welcome on board,
before posting please read first, the Survival Guide, try to search on forum and you get the answers faster.

I think viewtopic.php?f=7&t=6818 this link gives answer your question, you problem using regular expression. Good tutorial on oooninja webpage.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
User avatar
r4zoli
Volunteer
 
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Replacing paragraph mark..

Postby popeye » Fri May 20, 2011 1:29 am

Oh dear. I have the same question: can someone tell me where to look for the answer please? I am not sure I have the time or the disposition to go and research regexp to find out how to perform a simple "search and replace for paragraph marks" operation.
Word makes it easy. BBEdit makes it easy.Why should it be so difficult in OpenOffice?
Thanks.
OpenOffice 3.3 on Mac OS X
popeye
 
Posts: 4
Joined: Fri May 20, 2011 1:25 am

Re: Replacing paragraph mark..

Postby acknak » Fri May 20, 2011 2:41 am

There are a bunch of handy examples here: Regular expression samples [OOoNinja]

If you want specific suggestions, you'll have to tell us exactly what you're trying to do--replace paragraph marks with what? What are you trying to accomplish?
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 19476
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Replacing paragraph mark..

Postby popeye » Fri May 20, 2011 4:26 am

Thanks acknak, but I am really not a programmer and cannot understand those examples. I am a plain, boring user, trying to move away from MS Office. I didn't realise it could be so time consuming.
So I'll try to explain what I am trying to accomplish, although I assure you I have no need to consider examples when performing Search and Replace operations in all the other text editors/word processors I am familiar with (Word, BBEdit, Nisus, TextEdit, many others).
In this particular case, I wanted to reflow some text where an email program had broken off the lines at 80 characters or so. In BBEdit (for example), I know I can do that by entering \n in the search field, and whatever value I wish in the replace field (could be a space, a tab, a || or any other "marker" if I wish). So how do I accomplish this in OO Writer? Thanks.
OpenOffice 3.3 on Mac OS X
popeye
 
Posts: 4
Joined: Fri May 20, 2011 1:25 am

Re: Replacing paragraph mark..

Postby MrProgrammer » Fri May 20, 2011 7:57 am

Take a look at Alternative dialog Find & Replace for Writer. If the page is slow to load, try again later. They seem to be making infrastructure changes to some of the OOo pages and sometimes they aren't available.
Mr. Programmer
OpenOffice 3.2.0 Build 9483 on Mac OS X 10.9.5.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Volunteer
 
Posts: 1996
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Replacing paragraph mark..

Postby acknak » Fri May 20, 2011 2:51 pm

Edit > Find & Replace
Search for: $
Replace with: space (or whatever)
Options/Regular expressions: ON (checked)

Click "Replace all".

Note that this is a special case. When you use "$" all alone, it is treated as the actual line break for purpose of replacement. That is not the case when you use $ along with other things in the "Search for" field. For example, you can't use "$$" to search for two consecutive line breaks.
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 19476
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Replacing paragraph mark..

Postby popeye » Thu May 26, 2011 4:31 am

Edit > Find & Replace
Search for: $
Replace with: space (or whatever)
Options/Regular expressions: ON (checked)

Click "Replace all".


Great. Thank you acknak, this is exactly what I was looking for. Appreciate your help :-)
OpenOffice 3.3 on Mac OS X
popeye
 
Posts: 4
Joined: Fri May 20, 2011 1:25 am

Re: Replacing paragraph mark..

Postby popeye » Thu May 26, 2011 4:34 am

MrProgrammer wrote:Take a look at Alternative dialog Find & Replace for Writer. If the page is slow to load, try again later. They seem to be making infrastructure changes to some of the OOo pages and sometimes they aren't available.


Thanks Mr Programmer. I'd prefer a built-in function, as in all the other "writers" I've used. Do you know whether future OO versions might include this alternative/extended search&replace funcionality?
OpenOffice 3.3 on Mac OS X
popeye
 
Posts: 4
Joined: Fri May 20, 2011 1:25 am

Re: [Solved] Replacing paragraph mark..

Postby jameskhazar » Tue Aug 16, 2011 12:00 am

I've spent years avoiding learning regexp sytnax, it's serious overkill for such a simple (and often necessary) search and replace. It comes up often for me, like copying from a web page of a data table. For some reason the copy created a set of tabs and paragraph insertions that made it impossible to paste into a spread sheet. Simple to do in Word, find and replace ^t^p^t with ^t. After a half an hour's research and attempts with regex, still can't get it to work. I thought OpenOffice wanted to be on an even keel with MS Word. The lack of this one thing may force me to go back...
OpenOffice 3.3.0
OOO330,20 (Build:9567)
OS X 10.7
jameskhazar
 
Posts: 1
Joined: Mon Aug 15, 2011 11:53 pm

Re: [Solved] Replacing paragraph mark..

Postby mriosv » Tue Aug 16, 2011 3:06 am

There is an extension to do it:
Alternative searching 1.3.2 (AltSearch.oxt)
Copyright (c) 2007 Tomas BILEK
http://extensions.services.openoffice.o ... /AltSearch
LibreOffice 3.5.4 AOo-3.4 on Win 7 Ultimate
mriosv
 
Posts: 650
Joined: Mon Mar 09, 2009 1:12 am
Location: Galiza (España)

Re: [Solved] Replacing paragraph mark..

Postby arndtwc » Fri Jan 23, 2015 7:54 pm

I will agree with what jameskhazar said on Mon Aug 15, 2011 6:00 pm. I want to search for a paragraph marker and replace with two paragraph markers. Simple to do in MS Word. But Openoffice it is not possible. I am going back to MS Word.
Windows XP, Windows 7, with Openoffice 4.1.0
arndtwc
 
Posts: 1
Joined: Fri Jan 23, 2015 7:20 pm

Re: [Solved] Replacing paragraph mark..

Postby RoryOF » Fri Jan 23, 2015 8:02 pm

Wrong, wrong wrong!

Use Find and Replace. In Find box put $. In Replace box put \n\n. Drop More Options, check Regular Expressions, then do either single Replaces, or Replace All.

But if you are happier with MS Word, off you go.
Apache OpenOffice 4.1.1 on Xubuntu 14.10 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 16671
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] Replacing paragraph mark..

Postby acknak » Fri Jan 23, 2015 8:06 pm

arndtwc wrote:... I want to search for a paragraph marker and replace with two paragraph markers. ...

Edit > Find & Replace
Search for: $
Replace with: \n\n
Options/Regular expressions: ON

Click Replace All

Note: The replacement does not seem to happen for the last paragraph in the document, for some reason.
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 19476
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Replacing paragraph mark..

Postby John_Ha » Wed Jan 28, 2015 8:37 pm

arndtwc wrote:I am going back to MS Word.

Be sure to let us know if the MS Word forum is as good as this AOO forum for helping users to solve problems.
AOO 4.1.1
Windows 7 Home 64 bit
Intel dual core
John_Ha
Volunteer
 
Posts: 1214
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: [Solved] Replacing paragraph mark..

Postby Lupp » Wed Jan 28, 2015 10:34 pm

Ok. I've noticed the topic being marked [Solved].
What I missed - and still cannot find: How was it solved?

The original subject was: "Replacing paragraph mark.." .

I agree that we possibly haven't to replace an actual character (or2). It's about merging 2 or more paragraphs into one - and there will surely be implications (think alone of the complicated paragraph styles). This aside, and possibly forced to accept imperfect results : How can I simply merge 3 empty paragraphs into one? This a surely not too excentric task - and often needed.

Even the possible shortcomings of the ICU engine for regular expressions accepted there should be a way to also actually find the paragraph break as something we can delete or replace by something else and not only as a condition restricting the acceptance of a pattern like a "word boundary" e.g. Using \n for 'hard line break' when searching but for 'new paragraph' when replacing is a grave oddity IMO. Approximately the same with using $n for the nth variable containing found text"glued-together".
On Windows 8.1: LibreOffice 4.3.5, 4.4.0, PortableOpenOffice 3.2, 4.1.1, StarOffice 5.2
---
Maybe we might! (Create a powerful UFO: United Free Office)
User avatar
Lupp
 
Posts: 409
Joined: Sat May 31, 2014 7:05 pm

Re: [Solved] Replacing paragraph mark..

Postby acknak » Thu Jan 29, 2015 1:52 am

Lupp wrote:... and still cannot find: How was it solved?

As far as I see, the problem is that there are several related questions being asked and answered.

The actual answer depends on the document content and exactly what you want to do with it.
... How can I simply merge 3 empty paragraphs into one? ...

This precise task is not possible with OO, unfortunately.

However, there is (maybe) a workaround: you can remove empty paragraphs using the pattern ^$ and replacing with nothing. This is handled as a special case (I believe).

As far as I understand, this is not a limitation in the ICU regex library, but in the way the document data is structured and accessed by the code. It seems that fixing it may require a large effort. The switch to ICU was a huge improvement; I hope it will be cleaned up someday.

All that aside, I do a lot of messy text clean up and OO's find & replace works well enough to get the job done, even with its limitations.
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 19476
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: [Solved] Replacing paragraph mark..

Postby Lupp » Thu Jan 29, 2015 3:01 am

Thanks "acknak"!
Writer is not the component of Office I use most (and I never use Impress) ... Nonetheless I had more than once the actual need to merge "superfluos multiple inter-paragraphs" into single ones. I had to do the most of it manually.

How costly an enhancement?

I already mentioned in my post above that the present 'Find & Replace' is not capable of inserting a hard line break. At least the search code \n for it will, used in 'Replace with', cause insertion of a new paragraph. (Do you know another representation stepping in for \n ?) That is (Sorry!) idiotic. And it is not related with deeply coded-in properties of the regex engine. I judge it to be a thoughtlessness. We need another helper for inserting paragraphs. And we need a "Find & Replace" dialogue passing the line-break U+000A represented by \n e.g.to the ReplaceDescriptor. That's all. You can test it: Find an existing pattern (\n)a and use the (Sorry again: idiotic!) paraphrase Q$1R in 'Replace with'. Yo will get what should be expected: Q followed by a hard line break followed by R. The engine is capable of it. The user interface isn't.
On Windows 8.1: LibreOffice 4.3.5, 4.4.0, PortableOpenOffice 3.2, 4.1.1, StarOffice 5.2
---
Maybe we might! (Create a powerful UFO: United Free Office)
User avatar
Lupp
 
Posts: 409
Joined: Sat May 31, 2014 7:05 pm

Re: [Solved] Replacing paragraph mark..

Postby John_Ha » Thu Jan 29, 2015 1:30 pm

... How can I simply merge 3 empty paragraphs into one? ...

Will something like this work?

1 Replace every paragraph return by some unused sequence like £*f3@#Q. This will mess up the document in spades :-)

2 Search for £*f3@#Q£*f3@#Q£*f3@#Q and replace it by £*f3@#Q. That converts the three to one.

3 Search for £*f3@#Q and replace it by a paragraph return, which should automagically restore the document.
AOO 4.1.1
Windows 7 Home 64 bit
Intel dual core
John_Ha
Volunteer
 
Posts: 1214
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK


Return to Writer

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 36 guests