Page 1 of 1

Pronounciation-Editor-Entry Problem

Posted: Fri Feb 11, 2011 2:33 pm
by jackthebest
When I try to make speak the sentence

Ich, glaube, folgendes, hallo, hallo, du.

using the following regular expression to mark the comma (,), it pronounced only the first and the third one, the others not...
(([,][\s])[A-Z,Ö,Ä,Ü][a-z,ä,ö,ü,ß]+)[\s]
([\s]([,][\s])+[a-z,ä,ö,ü,ß]+)[\s]
(([,][\s])[A-Z,Ö,Ä,Ü][a-z,ä,ö,ü,ß]+)


How can I modify it successfully to make speaking each , ?
THANKS in advance!
Best wishes,
Jakob
PS: I mark the sentence in Word 2007...

Re: Pronounciation-Editor-Entry Problem

Posted: Fri Feb 11, 2011 8:11 pm
by PHenry1026
Greetings,

I am not sure what you are trying to do since you did not show the replacement string but modifying the second regex (([\s]([,][\s])+[a-z,ä,ö,ü,ß]+)[\s])to the following:

(?m)((^|[,][\s]|[\s][,]|\s)[a-z,ä,ö,ü,ß]+)(?=[\s]|\.)

should capture all words.

Percy Henry

Re: Pronounciation-Editor-Entry Problem

Posted: Fri Feb 11, 2011 11:58 pm
by PHenry1026
Actually if you are just interest in capturing the words a more elegant regex would be the following:

(?m)(?<=^|\s)([a-zäöüß]+)(?=,|\s|\.)

If you also want to pick-up the commas in you capturing parenthesis then following modification should do the trick:

(?m)(?<=^|\s)([a-zäöüß,]+)(?=\s|\.)

(?<=^|\s) is a look-behind and (?=,|\s|\.) is a lookahead; they do not consume any of the text and can be very useful since other regexes can subsequently work on the unconsumed test. In both examples the replacement text should use $1 only since (?<=^|\s) and (?=\s|\.) capture nothing.

Percy Henry