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

  • Home
  • SEARCH
  • 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 8249781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:39:43+00:00 2026-06-07T23:39:43+00:00

I have the following regex pattern to match: NSString *pattern=[NSString stringWithFormat:@%@(.*)%@, key, key2]; So

  • 0

I have the following regex pattern to match:

NSString *pattern=[NSString stringWithFormat:@"%@(.*)%@", key, key2];

So let say if key=\\\\[\\\\\[ and key2=\\\\]\\\\] then I am getting the string containing the
keys along with the contained text. But the problem is that if there are multiple matches then it only takes ist appearance of key and last appearance of key2 and gives me the text contained between those along with the keys. Eg.: This is [[some]] [[text]]. This gives me:[[some]] [[text]] as one match whereas I want [[some]] and [[text]] as separate matches. How should I modify it to give all the matches separately?

  • 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-07T23:39:44+00:00Added an answer on June 7, 2026 at 11:39 pm

    Same thing that bothers novice parser makers who wanna parse a string between quotes, and think that

    \\".*\\"
    

    is sufficient, but then are surprised when this matches all the text between

    "a string" and also "another string"
    

    The reason behind this is that the * operator is greedy. You have to use character set negation to achieve the expected result:

    \\[\\[[^\\[\\]]*\\]\\]
    

    Hope this helps.

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

Sidebar

Related Questions

I have the following aaaa_bb_cc string to match and written a regex pattern like
Say I have the following pattern: INDICATOR\s+([a-z0-9]+) which would match for example: INDICATOR AA
I've created the following regex pattern in an attempt to match a string 6
I have the following text string and regex pattern in a c program: char
I have written the following regex to match a set of e-mails from HTML
I have the following data: abc def; ghi. This regex will match: ([a-z0-9A-ZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ ]*)\W
Ok, this is really really weird. I have the following simple regex search pattern
Let's say we have the following input: <amy> (bob) <carol) (dean> We also have
If I have a simple regex pattern like ab. and I have a string
I'm using java.util.regex.Pattern to match passwords that meet the following criteria: At least 7

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.