I'm having trouble with a regular expression when targeting the Android platform 2.2.3.
The following regular expression works when targeting the Java VM on my desktop and the regular expression is also working on a .NET application too.
Pattern.compile("\\b?")
But when I target my phone I get a PatternSyntaxException. Any ideas?
I can confirm that this does throw a
PatternSyntaxException
when running in the Android emulator, but not in a regular Java application. I can't see why that would be the case, other than the fact that regular expression implementation used in Android is different than in the normal Java SDK. From the Pattern Android Developers page:As a work-around, I did discover that you can get around the exception by enclosing the word boundary assertion in a non-capturing group.
(A capturing group works as well, but I doubt you need it.)
I suggest you report this as a bug to see if you can get an official response. (I already searched, and it doesn't appear to be reported yet.)