Re: regular expression and speech dic



          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  

    A little kindness from person to person is better than a vast love for all humankind.

           ~ Richard Dehmel



Join to automatically receive all group messages.