Regular expression in the dictionary [Re: Expression régulière dans le dictionnaire]
On Fri, Nov 29, 2019 at 03:54 AM, Sylvain Machefert wrote:
The handbook does not explain the regular expressions but does not give only one small example. Admittedly, to explain the regular expressions is not the goal of the documentation of NVDA, but what must I put so that “get” (G E T) and “set” (SET) correctly marked at the beginning of word? Respectively “watches for” and “sette”…. very useful in programming.
While there are absolutely no language restrictions on the NVDA group, as a matter of practicality it is primarily an English language group.
To capture a character sequence that is at the beginning of a word, but that may or may not be the whole word, you can use the word boundary operator, \b, to anchor to a word boundary, generally white space in any amount, or a newline, preceding a word, then couple this with a wildcard for "word characters, \w, afterward occurring zero or more times. So, to match anything starting with the characters "set" you would use:
This would match the word "set" and the word "settings" in the first two sentences, but not "inset" in the third:
I need to set the table. How many place settings do we have? The niche is inset by 5 inches.
There are myriad tutorials on Regular Expressions on the web, and quite a few tools for testing the regular expressions you create (though I do not believe a lot of them would be accessible because visual highlighting is what's used to indicate what is and is not matched).
This page gets into real detail about matching word boundaries, probably too much: https://www.regular-expressions.info/wordboundaries.html
There are also a lot of cheat sheets out there for the most common kinds of matching.
Brian - Windows 10 Pro, 64-Bit, Version 1909, Build 18363
Most of the change we think we see in life is due to truths being in and out of favor.
~ Robert Frost, The Black Cottage (1914)