Remove text between bracket&quote

@karolus: yes, I had in mind possible nested brackets, but you’re right, in most cases my regexp will eliminate text between "]" and ["` too, which is faulty.

This is the object I’m trying to remove, there are hundreds of them.

[“347d23f1bb0da62618b6697874ee1f44”,“007d313d1ec38fdd1a1301652964d892”,“29279a336402408d6e65eab24f462d1d”,“adc6ec7131f8839b2d4e73b52a599dd9”,“c67454cd35a562a4616e5f3ecf1b1f0f”,

“863c64f07e8b09ae27cfcbf537490866”,“1bdc985c254706d078cb3519d0ae2406”,“72441c0f7c123778a806994b572c9d35”,“b20278aa86104259c665ceda23069348”,“1a5adbe1e0530a86071391b6567ae29c”, “c6d06cf3d2d252a5fac9c1afcad11d4c”,“ce4648aa3020d317a6d406b07c149454”,“b0ac643ac4d7252292112e45cff6b4e1”,“e26bee816491aeb419eee524e822669b”,“329f67760e3695650c71fb7224ee43c2”, “e2b88f11c2ada7469373491cf6deb552”,“f63cf63c9f47318f011007f3661e4143”,“82a91cbfcc58152bbb22b6d02ba0f704”,“55e788675b04f14280e97317f964e086”,“7a30500bbede64f6c3e7beacab7968b6”, “72efbc82c47700aff70d26eb858536e9”,“6548050d5305485f42d60efdeeb15351”,“dfb17668d8deb50989fbe521045fe230”,“1e196969137834e82edb46993af45447”,“e639628bc590d223ba9978b7a5204616”]

However, there are objects between brackets that are not in quotations that need to remain.

so may be there are typografic Quotes, try
\[".+?"\]

How to tell the difference?

did you check [x]regular Expression

Yes, I even inserted [“This is a test”] into the document as a test, and the search doesn’t find it.
it cannot, because This is a test is surrounded by typografic quotes, so try again with regex: \[“.+?”\] (copy and paste from here)

It all depends on what causes line breaks. It they are caused by line wrap or line breaks (Shift+Enter), the regexp should word. But if they are paragraph breaks, no luck, Find & Replace is limited to a paragraph contents.

To know which is used, enable View>Formatting Marks. Paragraph marks are displayed ¶ while line breaks are ↲.

It looks like your data comes from some computer output. You’d be better off with a specialised tool like awk or m4 to pre-process the plain text file before pasting it into Writer.

If it is too late (text is already in Writer or you can’t “comfortably” restore the rest of the text), you may have styled specially this sort of data. Remember that styling purpose is to mark up semantically your text. Typographical appearance comes later as a decoration for semantics. Then if your document is “correctly” styled, Find & Replace can eliminate all paragraphs with a given style.

1 Like

I’ve resized the font to see if the line returns are in the text or wrapped. There are hard line breaks between brackets, but they are not indented as a paragraph would be. In either case, the search fails to find the test I inserted that doesn’t have a paragraph or line break.

Your screenshot clearly shows you have typographical quotes in your test case, not straight quotation marks.

image_2021-10-14_103220
There are paragraphs in the text. I can remove the paragraphs but the syntax doesn’t catch the test pattern.

Removing the paragraphs is a tedious manual process. You can then manually remove the data instead.

Removing paragraph markers is done with the $ sign, I can replace the paragraph markers easily. But the syntax doesn’t catch the test pattern, so until the test pattern is recognized, there’s no point in replacing the paragraph markers.

I remember it is possible to remove the paragraph marks by search and replace but have to look up the details…

Your test failed because of other quotation marks, or it would have worked.

In your original data it failed because of the paragraph marks…

The $ sign is the syntax to find a paragraph in the writer search box.

So how to make it work with the quotation marks given?

so try again with regex: \[“.+?”\] (copy and paste the pattern from here)

And use your own question above as test.

But it will be altered on quoting, so we need fenced quotes:

["this is random text that will be removed along with the quotation marks and brackets."]

I copied and pasted you quotes and it works. So how did you get those particular quotation marks? I will remove all the paragraph markers and then use your syntax. Should work.

On this site it is a feature:

In writer it depends on your locale while typing…

If in doubt I just copy from my text and paste to the search box ( there are several hyphens and I know of 5 variants of space in UniCode )

Press Ctrl+H (Find and Replace)
enter “.*”