Ask Your Question
0

Regular Expression Limitation with Paragraph Replacement

asked 2016-11-30 13:23:00 +0100

Gameranand gravatar image

I got into a situation where it seems like there is no way forward. image description

After : there is paragraph break which I want to remove but when I search using :$, it searches just fine but no matter what I put in replace box, it doesn't remove the paragraph break.

I found that When I search :$ then it will search a paragraph break after : but won't remove the paragraph mark. Tabs, newlines, paragraphs \t \n $

So any alternative to this. I tried with Alt Search as well but it won't let me do the thing either.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2016-11-30 14:17:31 +0100

Lupp gravatar image

updated 2016-11-30 14:23:10 +0100

I do not write in Hindi or anything in 'Complex Text Layot' but I tested a bit just now with AltSerach V1.4.1 in LibO V5.2.2. (The previos AS V1.4 does not list LibO V5.)

You know that AltSearch is using a slightly extended and different coding?

$ is a "zero-width-lookahead-assertion" functionally while \p is denoting the next-paragraph-mark itself. Found groups (parentheses used in the search string) are denoted \1, \2 and so on in AltSearch.

Seraching for (:)\p the correct substrings were found - also if the text was inside a right to left sequence. Using \1 as replace string then replaced the combined finding with the colon allone and the next-paragraph-mark was deleted.

edit flag offensive delete link more

Comments

You my friend, are a lifesaver. :-)

Gameranand gravatar imageGameranand ( 2016-11-30 14:22:48 +0100 )edit
0

answered 2016-11-30 14:01:52 +0100

RGB-es gravatar image

updated 2016-11-30 14:05:10 +0100

Indeed, you cannot cross paragraph borders with the build-in regular expressions engine. That is: you can search for a paragraph break alone or for something that's at the en of a paragraph, but not both at the same time.

Try with the AltSearch extension instead that provides more options (maybe you need to use the [::BigBlock::] tag provided by the extension)

edit flag offensive delete link more

Comments

And how do I use that Big Block feature. Sorry I haven't used that extension that deeply. I have only used it for regular expression which gets too complicated using normal Find and Replace.

Gameranand gravatar imageGameranand ( 2016-11-30 14:13:58 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-11-30 13:23:00 +0100

Seen: 186 times

Last updated: Nov 30 '16