AltSearch across multiple paragraphs

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
kocj
Posts: 26
Joined: Mon Aug 20, 2018 8:19 am

AltSearch across multiple paragraphs

Post by kocj »

Has anyone been able to successfully use the [::BigBlock::] function?
[::BigBlock::] - searches for a block of paragraphs (of unlimited length) delimited by some known text:
start[::BigBlock::]end – first, start is searched for, and when it is found, end is searched for. If both are found, the whole block between them is selected.
In the replace string you can use the parameters \b, & or \e for inserting the contents of start, found block of paragraphs, or end, respectively.
Limitation: In the initial and final strings you cannot use the || sign for multiple searching and replacing; see below.
I am able to mark the block, however replacing with \b, \0 or \e does not work for me. It deletes the whole selection.

Is there any alternative to select multiple paragraphs?
This did not work
Search: start((.|\P)*)end
Replace: \1

kocj
Libreoffice on Debian
User avatar
RoryOF
Moderator
Posts: 34799
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: AltSearch across multiple paragraphs

Post by RoryOF »

It works for me; you must have Regular Expressions checked. Remember you are working with AltSearch, not with the normal Find and Replace.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
kocj
Posts: 26
Joined: Mon Aug 20, 2018 8:19 am

Re: AltSearch across multiple paragraphs

Post by kocj »

@ RoryOF

My I ask, did you do the replace with & or \0?
& gives me a

Code: Select all

Basic runtime error
An exception occured
Type: com.sun.star.resource.MissiningResourceExeption
Message: StringResourceImpl: No entry for ResourceID: 
At line 1686 seznam.addItem(neco,0)

I found out that it is possible with \0\f to just replace the text between the markers, however if i try to apply a paragraph style i get.

Code: Select all

ReplDo: Error 91: object variable not set. (line: 3749)
I can press the Ok button, the text still gets replaced as it should, but the par-style does not get applied.

I am on Debian 9, this happens with LO 5.3 and 6.1 form testing too.

Should i contact the developer?
Is there any a way to do this with regex?

kocj
Libreoffice on Debian
User avatar
RoryOF
Moderator
Posts: 34799
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: AltSearch across multiple paragraphs

Post by RoryOF »

I have just checked - I used \0 and again in another test &; in both cases, they worked.

I suggest you play with a short sample file until you get this working.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
kocj
Posts: 26
Joined: Mon Aug 20, 2018 8:19 am

Re: AltSearch across multiple paragraphs

Post by kocj »

Thank you, good to know that it works for you.
Are you able to apply a par-style just to the replaced section too?

Do you have any suggestions about the error messages?
using & instead of \0 in the replace field gives me the same runtime error also in other situations, till now it did not matter to me.

Ps: I am play around with AltSearch since tow weeks now, i have been able to do all the other things i wanted till now.
PPS: Do you know where to activate the compatible mode that is mentioned it the help doc? I would like to play around with subversions to bypass this.

kocj
Libreoffice on Debian
Post Reply