Topics

Regular expression in the dictionary [Re: Expression régulière dans le dictionnaire]

Sylvain Machefert
 

Bonjour,

Le manuel n'explique pas les expressions régulières mais ne donne pas un seul petit exemple.
Certes, expliquer les expressions régulières n'est pas le but de la documentation de NVDA, mais que dois-je mettre pour que "get" (g e t) et "set" (s e t) soient prononcés correctement en début de mot ? Respectivement "guette" et "sette".... très utile en programmation.

Merci


--
Sylvain Machefert

 

On Fri, Nov 29, 2019 at 03:54 AM, Sylvain Machefert wrote:
Le manuel n'explique pas les expressions régulières mais ne donne pas un seul petit exemple.
Certes, expliquer les expressions régulières n'est pas le but de la documentation de NVDA, mais que dois-je mettre pour que "get" (g e t) et "set" (s e t) soient prononcés correctement en début de mot ? Respectivement "guette" et "sette".... très utile en programmation.
English Translation:

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:

                     \bset\w*

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)

 

 

Brian Tew
 

I have found out the hard way that regular expressions vary in different settings.
It would be nice if nvda domumented exactly which implementation or re it uses. 

 

On Fri, Nov 29, 2019 at 03:32 PM, Brian Tew wrote:
nvda domumented exactly which implementation or re it uses
I believe Python, as NVDA is written in Python and uses Python libraries.  I seem to recall this being documented somewhere, but I'll be darned if I know where.

There are several regular readers who will certainly be able to confirm or refute my recollection.
 
--

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)

 

 

 

Hi,

I think this person is talking about syntax. If so, NVDA expects Python-style regular expressions.

Cheers,

Joseph

 

From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of Brian Vogel
Sent: Friday, November 29, 2019 1:21 PM
To: nvda@nvda.groups.io
Subject: Re: [nvda] Regular expression in the dictionary [Re: Expression régulière dans le dictionnaire]

 

On Fri, Nov 29, 2019 at 03:32 PM, Brian Tew wrote:

nvda domumented exactly which implementation or re it uses

I believe Python, as NVDA is written in Python and uses Python libraries.  I seem to recall this being documented somewhere, but I'll be darned if I know where.

There are several regular readers who will certainly be able to confirm or refute my recollection.
 
--

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)

 

 

 

On Fri, Nov 29, 2019 at 04:23 PM, Joseph Lee wrote:
If so, NVDA expects Python-style regular expressions
Which confirms what I thought.  Since the conversation was about which Regular Expression syntax was being used, and Python is one of those, I left off "syntax" as it seemed repetitive.

But since NVDA is written in the Python programming language it only makes sense that it would use Python Regular Expression syntax, as I'd have to believe it relies on the regular expression libraries under Python for interpreting them.  If the answer had been anything else it would have come as a big shock.
 
--

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)

 

 

Luke Davis
 

I believe the question needs some more context.
How would you like them marked?
What would you like spoken to indicate the word get? What spoken for the word set?

Since you are talking about getters and setters in code, it is likely you want two regular expressions like this, with case sensitivity set to on:

\bget[A-Z0-9_]
\bset[A-Z0-9_]

If you are using a language which capitalizes inner words by convention.

That would pick up:

getMyVariable()
setOtherVariable()

But not:

getmyVariable()
setmyVariable()

Luke

On Fri, 29 Nov 2019, Brian Vogel wrote:

On Fri, Nov 29, 2019 at 03:54 AM, Sylvain Machefert wrote:
Le manuel n'explique pas les expressions régulières mais ne donne pas un seul petit exemple.
Certes, expliquer les expressions régulières n'est pas le but de la documentation de NVDA, mais que dois-je mettre pour que "get" (g e t) et "set" (s
e t) soient prononcés correctement en début de mot ? Respectivement "guette" et "sette".... très utile en programmation.
English Translation: 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:                     \bset\w*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.htmlThere 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)
 
 
--
Luke Davis
Moderator: the new NVDA Help mailing list! (https://groups.io/g/NVDAHelp)
Author: Debug Helper NVDA add-on (https://addons.nvda-project.org/addons/debugHelper.en.html)