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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:15:30+00:00 2026-05-23T15:15:30+00:00

RegexBuddy shows the matches are OK, but in C# when I try use replace,

  • 0

RegexBuddy shows the matches are OK, but in C# when I try use replace, a semicolon and a curly bracket are not replaced.

The expression I am using is the following:

@"({\\)(.+?)(}+)|(\s?\\)(.+?)(\b)|}$"

and the input text (rtf) is included in the screenshot.
This the code:

Regex reg2 = new Regex(@"\\b([\s\S]+?)\\b0");
MatchCollection matches = reg2.Matches(text);

foreach (Match match in matches)
{
    string output = reg.Replace(match.Value, "");
    MessageBox.Show(output);
}

RegexBuddy screenshot

  • 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-23T15:15:30+00:00Added an answer on May 23, 2026 at 3:15 pm

    You are trying to match nested structures with regular expressions. Look at your screenshot: in the first line there are three opening braces and one closing brace, in your third line you have one opening and two closing braces etc.

    While .NET does provide ways to do nested pattern matching with regexes, your regex is not using them (and it’s extremely mystifying to me what exactly you’re hoping to achieve).

    You most certainly need to use a different way to parse RTF files; unfortunately I don’t know whether the .NET libraries provide an RTF parser.

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

Sidebar

Related Questions

I found the regular expression for MM/DD/YYYY at http://www.regular-expressions.info/regexbuddy/datemmddyyyy.html but I don't think I
To be honest, I suck at regex so much, I would use RegexBuddy, but
I use RegexBuddy while working with regular expressions. From its library I copied the
One of my developers has started using RegexBuddy for help in interpreting legacy code,
Which regular expression engine does Java uses? In a tool like RegexBuddy if I
I use this regular expression for validating some of my textbox : Regex re
I am trying to convert the following regular expression from Java to .NET: (?i:(?:([^\d,]+?)\W+\b((?:CA|SD|SC|CT|DC)\b)?\W*)?(\d{5}(?:[-
I am attempting to parse a string like the following using a .NET regular
I need a regular expression that I can use in VBScript and .NET that
I've bought RegexBuddy, given it a try and unless I am matching on something

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.