OK more info.
I'm reading a the input from a barcode scanner using
If AStream.IsInitialized = False Then
AStream.Initialize(serial1.InputStream,Null, "AStream")
End If
What I get from the scanner is the following:
""
What I want to do is extract all the numbers (18) in this case, however the length can be between 9 and 24 digits - which is a barcode.
I extract the digits using
Matcher1 = Regex.Matcher(pattern, Matcher1.Match)
and I can log the result using
Log("Found Barcode: " & Matcher1.Match)
BUT when I try and assign Matcher1.Match to a text label I get this dump
java.lang.IllegalStateException: No successful match so far
at java.util.regex.Matcher.ensureMatch(Matcher.java:607)
at java.util.regex.Matcher.group(Matcher.java:358)
at anywheresoftware.b4a.keywords.Regex$MatcherWrapper.Group(Regex.java:138)
at com.idealss.com.bticketmanager.main._logmessage(main.java:1840)
at com.idealss.com.bticketmanager.main._astream_newdata(main.java:729)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA$3.run(BA.java:296)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3688)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
java.lang.IllegalStateException: No successful match so far