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 8769433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:20:52+00:00 2026-06-13T17:20:52+00:00

The following seemingly innocuous pattern is causing a PatternSyntaxException: String pattern = ^(?:.*)\\s*{$; //

  • 0

The following seemingly innocuous pattern is causing a PatternSyntaxException:

String pattern = "^(?:.*)\\s*{$"; // pattern is:   ^(?:.*)\s*{$

As you can see when you look at it in regexpal, it seems to work properly there.

For example, that string should match:

name {

The message I’m getting back is “Illegal repetition near index 9”, but I have no idea what I’m doing that’s illegal. The offending character is supposed to match any number of whitespace characters between the final section and the {.

Can anyone spot what I’m doing wrong?

  • 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-06-13T17:20:53+00:00Added an answer on June 13, 2026 at 5:20 pm

    You need to escape the { with \\.

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

Sidebar

Related Questions

Can anyone tell me what causes this seemingly odd Do behavior in the following
I have the following seemingly innocuous piece of code: #ifndef UI_H #define UI_H #include
This is from project Euler, problem 2. I wrote the following seemingly innocent code:
I'm trying to do the following, seemingly simple thing. If a key is pressed
It seems that Objective C jumps thru hoops to make seemingly simple tasks extremely
I was having problems inserting a string into the following tag : <tr id=rowBulkOptions
This should be seemingly obvious and simple, but it isn't for me and seems
Apologies for the seemingly simple question, but I can't seem to find a solution
I have just crafted the following test using Rhino mocks. Does my test look
It seems to me from the following page http://www.eclipse.org/eclipse/platform-team/target.php and other pages like it.

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.