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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:02:45+00:00 2026-05-11T19:02:45+00:00

As usual, regular expressions are causing my head to hurt. I have the following

  • 0

As usual, regular expressions are causing my head to hurt.

I have the following strings (as examples) which I would like to parse:

Client: {Path=ClientName}, Balance: {Path=Balance, StringFormat='{0:0.00}'}
Client: {Path=ClientName}, Balance: {Path=Balance, StringFormat='Your balance is {0:0.00}.'}

I am looking for a regular expression (or any other method) which could split the strings as follows and then get the individual key/value values of each. (The idea is to resolve each one of these to a XAML binding)

String 1: {Path=ClientName}

    Path = ClientName

String 2: {Path=Balance, StringFormat='{0:0.00}'}

    Path = Balance
    StringFormat = {0:0.00}

At the moment I have the following regular expression to split the strings but this gets confused by the value of StringFormat due to the ‘}’ in the value.

(?<!'){(.+?)}(?!')

Any idea how I can achieve this?

Thanks!

  • 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-11T19:02:45+00:00Added an answer on May 11, 2026 at 7:02 pm

    It gets really tiring solving this same problem over and over, but here you go:

    Technically, you’re doing it wrong, you should use a parser, regular expressions aren’t built to deal with nested matching parenthesis, blah blah blah. We can hack this one together, though, so why not?

    /(?<!'){([^'}]|'[^']+')+}(?!')/
    

    The meat of that – {([^'}]+|'[^']+')} – looks for two things: a) anything that’s not a } or a ' character ([^'}]), and b) anything that looks like a string ('[^']+'). It assumes a string is a quote, a bunch of non-quote text, and another quote. Given your examples, this should work.

    It will, however, fail to match 'This is a string with \'quotes\' in it', because it isn’t designed for escaped quotation marks. Adding this is simple, and involves applying the principles we just applied, so I’ll leave that to you to figure out if you can. You seem to be pretty good with regular expressions, and you at least made a start on this before you asked it, so I think you can figure out how to make it match \' in a string.

    EDIT: You’re using 's instead of "s. Sorry about that.

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

Sidebar

Related Questions

I would like a regular expression, of which I will use with the Python
The usual alpha symbol for regular expressions \w in the .NET Framework matches alphanumeric
I have a script that utilizes a hash, which contains four strings as keys
I have a website built with Django that I would like to combine with
The usual way to assign color box functionality on a link is like this:
The usual pattern for a singleton class is something like static Foo &getInst() {
I have the following code in my application: using (var database = new Database())
The usual definition for a specialization of a template function is something like this:
My usual 'x' usage was : print(# x 78, \n); Which concatenates 78 times
I have anchored REST services/methods to URI template by @Path annotation. It looks like

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.