Regular expression works with Altsearch but not with Advanced Search

Hi,
I just noticed that the following regular expression works with Altsearch (only selecting find all) but not with LO Advanced Search: (\s)+([\.\!\?,:;»”›’\)\]])⁠⁠
Any clues why?

Thanks in advance.

Version: 24.2.4.2 (AARCH64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded

Tested with more than one document inclunding the attached one:
Search space plus comma bug.odt (40.4 KB)

Works for me. LO 24.2.4.2 and 7.6.7.2, Fedora 40 KDE Plasma
But copying your regexp without precaution brought in spaces and wiped out the escapes. I patched your question to avoid this problem.

I tested in Edit>Find & Replace (not knowing what you meant with “Advanced Search”)

3 Likes

Or rather, shown why it failed for @Earendil without the proper escaping.

Thank you @mikekaganski and @ajlittoz,

sorry for the inaccuracy.

True, I copied and pasted it again and it now works, somehow I did not paste it well here in asklibreoffice, I am using the extension Alternative find and replace (not Advanced search and replace), but some regex only partially work there or not at all, so I interact with LO find and replace.

This was my original regex and pasting it without additional characters gives the expected result: (\s+)([\.\!\?,:;»”›’\)\]])

Thanks a million for the precise answer!


ajlittoz: I again patched your regexp; the “escape” quotes on this sites are “backticks” U+0060 GRAVE ACCENT, not U+0027 APOSTROPHE.

If you want to paste on this site without the engine altering it subtly, then click the Preformatted text icon, 6th from left (or press Ctrl+E), first and then paste over the highlighted text, Preformatted text

Thanks everybody, I think that I got it now!

As a side note, within a set expression backslash-escaping characters is unnecessary, except for the literal closing ] bracket. So (\s)+([.!?,:;»”›’)\]]) should do.

@erAck tested it and it worked!