Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6054215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:07:41+00:00 2026-05-23T08:07:41+00:00

I am getting a java.util.regex.PatternSyntaxException when trying to call string.split() with the regex (?<=}),(?=\\{)

  • 0

I am getting a java.util.regex.PatternSyntaxException when trying to call string.split()
with the regex (?<=}),(?=\\{) against a string such as “{test},{test}”

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:

  java.util.regex.PatternSyntaxException: Syntax error U_REGEX_RULE_SYNTAX near index 5:
        (?<=}),(?=\{)
        ^
        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:
        (?<=}),(?=\{)
        ^
        at java.util.regex.Pattern.compileImpl(Native Method)
        at java.util.regex.Pattern.compile(Pattern.java:400)
        at java.util.regex.Pattern.<init>(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)

I’m wondering if the Android runtime doesn’t support regex lookaheads, can anyone confirm this or offer any suggestions for solving this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:07:41+00:00Added an answer on May 23, 2026 at 8:07 am

    This android/java regex page indicates that lookbehinds are supported and that you have the correct syntax for it.

    I don’t see how escaping the { can cause a problem with the regex. Have you tried this form of the expression? string ex = "(?<=\\}),(?=\\{)";

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a java outOfMemoryError when I call this method - i'm using it
So, I'm getting stuck with this piece of code: import java.util.InputMismatchException; import java.util.Scanner; public
import java.util.*; public class Test { public static void main(String[] args) { Map<String,String> map
I am getting the following warning from my NetBeans IDE. Suspicious call to java.util.Collection.contains
I have three programs, first does a selenium test import com.thoughtworks.selenium.*; import java.util.regex.Pattern; import
We're getting this error java.lang.NullPointerException at java.util.ArrayList.<init>(Unknown Source) at de.mystuff.ExtendedArrayList.<init>(ExtendedArrayList.java:38) where ExtendedArrayList:38 is new
I am getting this exception on my tomcat server (+liferay) java.util.concurrent.RejectedExecutionException my class is
I am getting the following exception. java.util.NoSuchElementException: No line found I got this error
I'm getting a java.awt.FontFormatException: Unrecognised Font Format error, and I believe this has been
I'm getting stack traces like this: java.lang.NoClassDefFoundError: sun/reflect/GeneratedMethodAccessor1 at sun.reflect.GeneratedMethodAccessor1.<clinit>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.