AltSearch across multiple paragraphs

Writing a book, Automating Document Production - Discuss your special needs here

AltSearch across multiple paragraphs

Postby kocj » Thu Sep 06, 2018 11:45 am

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 5.3 and 6.1 on Debian Stretch 9.5
kocj
 
Posts: 13
Joined: Mon Aug 20, 2018 8:19 am

Re: AltSearch across multiple paragraphs

Postby RoryOF » Thu Sep 06, 2018 1:45 pm

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.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28560
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: AltSearch across multiple paragraphs

Postby kocj » Thu Sep 06, 2018 2:44 pm

@ RoryOF

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

Code: Select all   Expand viewCollapse view
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   Expand viewCollapse view
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 5.3 and 6.1 on Debian Stretch 9.5
kocj
 
Posts: 13
Joined: Mon Aug 20, 2018 8:19 am

Re: AltSearch across multiple paragraphs

Postby RoryOF » Thu Sep 06, 2018 3:03 pm

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.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 28560
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: AltSearch across multiple paragraphs

Postby kocj » Thu Sep 06, 2018 3:57 pm

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 5.3 and 6.1 on Debian Stretch 9.5
kocj
 
Posts: 13
Joined: Mon Aug 20, 2018 8:19 am


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 2 guests