Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.util.regex.PatternSyntaxException on Android
    primarykey
    data
    text
    <p>I am getting a <code>java.util.regex.PatternSyntaxException</code> when trying to call string.split() with the regex <code>(?&lt;=}),(?=\\{)</code> against a string such as "{test},{test}"</p> <p>This works fine when I run it in a unit test on the JVM (ie. not on Android) but on Android I get the following stack trace:</p> <pre><code> java.util.regex.PatternSyntaxException: Syntax error U_REGEX_RULE_SYNTAX near index 5: (?&lt;=}),(?=\{) ^ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3683) 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:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: java.util.regex.PatternSyntaxException: Syntax error U_REGEX_RULE_SYNTAX near index 5: (?&lt;=}),(?=\{) ^ at java.util.regex.Pattern.compileImpl(Native Method) at java.util.regex.Pattern.compile(Pattern.java:400) at java.util.regex.Pattern.&lt;init&gt;(Pattern.java:383) at java.util.regex.Pattern.compile(Pattern.java:374) at java.lang.String.split(String.java:2021) at java.lang.String.split(String.java:2002) </code></pre> <p>I'm wondering if the Android runtime doesn't support regex lookaheads, can anyone confirm this or offer any suggestions for solving this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload