I am trying to massage string text that I get from a website and pipe it to the text-to-speech engine. I would like to understand the difference between B4A regex and regex with the reflector. What I am doing is removing the period from abbreviations and replacing with a blank. Text-to-speech does a nasty pause on periods where you don't want it to. I get it to work with the reflector sort of but not with the other. I could just call it a day since I am getting almost the results that I am looking for. But I would like to know how to make it work with B4A's regex. Here is my code that almost works. I do have something wrong where " U.S. " changes to " U S " but U.S.S.R. gets changed to "USSR" which is what I want. I'll figure that one out eventually though.
But if I choose to use B4A I can't get it to work. I am not sure what the Template does even after looking at the docs.
If anyone can enlighten me it would be nice. BTW disregard the template value for that is the last value that I tried. Also regex is not my forte along with a lot of other things.
B4X:
Pattern = "\.(?![A-Z]{2})"
Replacement = ""
m = Regex.Matcher(Pattern, Text)
Dim r As Reflector
r.Target = m
Text = r.RunMethod2("replaceAll", Replacement, "java.lang.String")
But if I choose to use B4A I can't get it to work. I am not sure what the Template does even after looking at the docs.
B4X:
Regex.Replace("\.(?![A-Z]{2})", Text, " $")
If anyone can enlighten me it would be nice. BTW disregard the template value for that is the last value that I tried. Also regex is not my forte along with a lot of other things.