At the moment, LO's regex capability does not include matching patterns across multiple paragraphs. Also, the $ character matches the end of a paragraph (not a line break or a line ending through wrapping). Now, if in my document I have some text, then a paragraph break, then some more text, and I try a regex search with the pattern: \.$\. I expect to be told "Patterns with text beyond an end-of-paragraph marker $ are invalid." or "are not supported" etc. Instead, I am told "Search key not found" - which suggests such patterns _are_ valid, and _might_ be matched, but the text doesn't have them. Now, I would love it if support for past-end-of-paragraph were implemented, but while that's not happened - the user should be told that they can't do that.
+1 to clarify the "Search key not found" error when users enter invalid/unsupported regular expression(s).
Perhaps this would be an easyHack?
(In reply to Eyal Rozenberg from comment #0) > Instead, I am told "Search key not found" - which suggests such patterns > _are_ valid, and _might_ be matched, but the text doesn't have them. There are many patterns that are not supported. What about all of them? I suggest not to use an specific message for each error, but to change the message (when [x] Regular expressions) something like: "Search key not found or invalid search pattern". Reproducible with: Version: 6.4.7.2 (x64) Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5 CPU threads: 12; OS: Windows 10.0 Build 17763; UI render: GL; VCL: win; Locale: es-MX (es_AR); UI-Language: en-US Calc: threaded
(In reply to LeroyG from comment #3) > (In reply to Eyal Rozenberg from comment #0) > > Instead, I am told "Search key not found" - which suggests such patterns > > _are_ valid, and _might_ be matched, but the text doesn't have them. > > There are many patterns that are not supported. What about all of them? Well, all of them should result in an error message saying something like "Search pattern not supported" rather than "Search key not found" (or better yet, a brief text saying why the pattern is not supported.) > I suggest not to use an specific message for each error, but to change the > message (when [x] Regular expressions) something like: "Search key not found > or invalid search pattern". But we know which one of the two possibilities it was; no reason to obfuscate things for the user.
(In reply to LeroyG from comment #3) > message (when [x] Regular expressions) something like: "Search key not found > or invalid search pattern". Sounds reasonable. (In reply to Eyal Rozenberg from comment #4) > But we know which one of the two possibilities it was... Do we? Well in this case we can show a different message or even block the search.
(In reply to Heiko Tietze from comment #5) > Do we? I am 99% sure, that whatever library or facility we use to perform the pattern search distinguishes between an invalid search pattern and the case of no matches found. It's like that in sed, and grep, and JS functionality, and in PCRE you first compile and then match, etc. etc. > Well in this case we can show a different message or even block the > search. That's basically what I meant.
(In reply to Eyal Rozenberg from comment #6) > I am 99% sure... I guess we do something like while FindNext(*params) { DoSomeMagic(); } MessageBox("No more results");
(In reply to Heiko Tietze from comment #7) Well, we're just guessing... I would guess it should be something like: needle = Compile(patterm); while FindNext(haystack_iterator, needle) { DoSomeMagic(); } but even if it's just like you described it, you can still probably do: if (not ValidPattern(*params); { HandleInvalidPattern(*params); } else while FindNext(*params) { DoSomeMagic(); } or: else while FindNext(*params) { DoSomeMagic(); } status = GetFindState(); if (status == PatternIsInvalid) { HandleInvalidPattern(*params); }