toggle quoted messageShow quoted text
Brian, you are so smart for helping me, many thanks.
In fact why I created such a regular expression is because what I
have created in the speech dic didn't work.
I first created a whole word speech dic of "lv" and replace by a
and found that most of the time lv will be spoken as level instead,
except when lv is followed by numbers immediately.
Therefore I want to create some like a regular expression to include
all "lv" that is not followed by any english word.
Brian Vogel 於 23/8/2018 10:18 寫道:
Your problem is that the "lv" matches those two
characters exactly, but "(^a-z)" captures ONE character that is
not lower case a through lower case z.
If you want something of the form "lv12" pronounced as
"level 12" you would use the regular expression: lv([0-9]+)
and the substitution would be: level \2
The regular expression I gave says, "Match the
characters 'lv' literally, then match one or more repetitions of
the numeric digit characters, saving them for later use, which is
what the parentheses around that part of the expression does.
Since you know the "lv" is to be pronounced "level," there's no
need to capture it for later use, but you need the digit sequence,
whatever it may be, to be spoken later, and the parentheses allow
it to be referred to later, as a unit as "\2" [the second match,
where "lv" was the first match, but not saved because there were
no parentheses around it].
Brian - Windows
10 Home, 64-Bit, Version 1803, Build 17134
kindness from person to person is better than a vast love
for all humankind.