Bug 91755 - [LOCALHELP] Writer: regex helps misses examples 'x not y'
Summary: [LOCALHELP] Writer: regex helps misses examples 'x not y'
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks: Help-Changes-Features
  Show dependency treegraph
 
Reported: 2015-05-30 16:02 UTC by Nick Levinson
Modified: 2021-11-06 10:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Levinson 2015-05-30 16:02:16 UTC
I wanted to search for (without quotation marks) "wrap-up" but not "/wrap-up/". Without the slashes, the string occurred 191 times in the file. I didn't see a regex for something like "x not y". If that doesn't exist, it should be added. If it does exist and I missed it in the list of regular expressions in the Help file when I searched the list for the string "not", the Help file should be clarified.
Comment 1 Gordo 2015-05-30 16:56:32 UTC
(?!/)(wrap-up)(?!/)

Positive and Negative Lookahead
(?= ) and (?! )

Positive and Negative Lookbehind
(?<= ) and (?<! )
Comment 2 Nick Levinson 2015-05-30 19:47:53 UTC
Interesting, but at least three of the nonalphanumeric characters in the above are not in Help's List of Regular Expressions. Could the basis of this maneuver be explained in Help, so it's not a secret among just a few of us? I'm changing the status accordingly. Thanks.
Comment 3 V Stuart Foote 2020-09-24 19:15:01 UTC
ICU libs, which LibreOffice keeps current with are the basis for regex support. 

Regex syntax like Look-ahead / Look-behind assertions are detailed in the ICU User Guide as linked in the LibreOffice Help: https://help.libreoffice.org/7.0/en-US/text/shared/01/02100001.html

Recently the ICU project relocated resources, now LO help is linked incorrectly. Help points to the old ICU User Guide article here: http://userguide.icu-project.org/strings/regexp

Now located here:

https://unicode-org.github.io/icu/userguide/strings/regexp.html

Not clear the project help article needs to be expanded as the ICU documentation is comprehensive. 

@Olivier?
Comment 4 Commit Notification 2020-10-02 11:09:42 UTC
Seth Chaiklin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/d06eb1014e0243acd382ee34fcea7caaad2356aa

tdf#91755  update URL for ICU regex documentation
Comment 5 sdc.blanco 2020-10-02 11:42:43 UTC
(In reply to V Stuart Foote from comment #3)
> Recently the ICU project relocated resources, now LO help is linked
> incorrectly. 
Patch in comment 3 updates the link.

> Not clear the project help article needs to be expanded as the ICU
> documentation is comprehensive. 
Shall we take a bold decision?

1. Nick's request could be addressed by adding an example that addresses non-alphanumeric.  (e.g. to find all cases of word but not "word").
Other examples on the page give the template for how to present the example. 

If someone would provide the text, then I would add it to the regex help page.

(the downside with this solution is that the relevant regex operators are not mentioned on the page. Would be relevant to add them -- but the ICU explanation is incomprehensible, unless you know already know regex -- in which case a link to the relevant "manual" might be better -- and two relevant links are already available.)

2. Maybe better to add a tip on:  "Using Regular Expressions in Text Searches"
https://help.libreoffice.org/7.1/en-US/text/swriter/guide/search_regexp.html
(isn't that where a user might search?)  And instead of explaining how, just give a short tip that indicates possibilities (which the user then has to RTM). For example:  

To search for (Nick's type of case) here, then use (relevant syntax).

or

Use Positive Lookahead, Negative Lookahead, Positive Lookbehind, and Negative Lookbehind to (short explanation of what they are good for).  See (link to ICU manual) for relevant operators.

3.  And if 1 and 2 are rejected, then I propose this bug be resolved as NAB or WF.
Comment 6 Olivier Hallot 2021-11-06 10:18:40 UTC
Regex is a nice feature far from trivial to master by the average user. Besides, it has ab awful notation that is very hard to memorize if you don't use it everyday.

My take is that the subject is better handled in a tutorial in the wiki.

A link in the help page to the wiki is a possibility.

if that helps, this page can inspire: https://pythex.org/