regex or mask help

Forum for TextAloud version 4

Moderator: Jim Bretti

Post Reply
gwp1
Posts: 3
Joined: Mon Jan 21, 2013 1:33 pm
Contact:

regex or mask help

Post by gwp1 »

Time is presented in document as "459 PM"

It is read as "four hundred fifty-nine PM".

I need for it to be read as "four fifty-nine PM". This obviously needs to be for any time in either three or four digit format and I have beat my head against the proverbial wall and not been successful.

Guidance appreciated, please.
Jim Bretti
Posts: 1558
Joined: Wed Oct 29, 2003 11:07 am
Contact:

Re: regex or mask help

Post by Jim Bretti »

One way to do this is with an expression that looks for three digits followed by a space, then am or pm. Then respell the match, inserting a space between the first and second digit.

Give this a try:

Regular Expression:
(\d)(\d\d)(?=\s(A|P)M)

Respell:
$1 $2

There is a very good regular expression reference at https://www.regular-expressions.info/ if you need help with regular expressions
Jim Bretti
NextUp.com
Post Reply