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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:53:25+00:00 2026-06-17T06:53:25+00:00

Problem: Cannot find a consistent way to replace a random string between quotes with

  • 0

Problem:

Cannot find a consistent way to replace a random string between quotes with a specific string I want. Any help would be greatly appreciated.

Example:

String str1 = "test=\"-1\"";

should become

String str2 = "test=\"31\"";

but also work for

String str3 = "test=\"foobar\"";

basically I want to turn this

String str4 = "test=\"antyhingCanGoHere\"";

into this

String str4 = "test=\"31\"";

Have tried:

Case insensitive Regex without using RegexOptions enumeration

How do you do case-insensitive string replacement using regular expressions?

Replace any character in between AnyText: and <usernameredacted@example.com> with an empty string using Regex?

Replace string in between occurrences

Replace a String between two Strings

Current code:

    Regex RemoveName = new Regex("(?VARIABLE=\").*(?=\")", RegexOptions.IgnoreCase);
    String convertSeccons = RemoveName.Replace(ruleFixed, "31");

Returns error:

System.ArgumentException was caught
  Message=parsing "(?VARIABLE=").*(?=")" - Unrecognized grouping construct.
  Source=System
  StackTrace:
       at System.Text.RegularExpressions.RegexParser.ScanGroupOpen()
       at System.Text.RegularExpressions.RegexParser.ScanRegex()
       at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
       at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
       at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options)
       at application.application.insertGroupID(String rule) in C:\Users\winserv8\Documents\Visual Studio 2010\Projects\application\application\MainFormLauncher.cs:line 298
       at application.application.xmlqueryDB(String xmlSaveLocation, TextWriter tw, String ruleName) in C:\Users\winserv8\Documents\Visual Studio 2010\Projects\application\application\MainFormLauncher.cs:line 250
  InnerException: 

found answer

string s = Regex.Replace(ruleFixed, "VARIABLE=\"(.*)\"", "VARIABLE=\"31\"");
ruleFixed = s;

I found this code sample at Replace any character in between AnyText: and with an empty string using Regex? which is one of the links i previously posted and just had skipped over this syntax because i thought it wouldnt handle what i needed.

  • 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-17T06:53:26+00:00Added an answer on June 17, 2026 at 6:53 am
    string s = Regex.Replace(ruleFixed, "VARIABLE=\"(.*)\"", "VARIABLE=\"31\"");
    ruleFixed = s;
    

    I found this code sample at Replace any character in between AnyText: and <usernameredacted@example.com> with an empty string using Regex? which is one of the links i previously posted and just had skipped over this syntax because i thought it wouldnt handle what i needed.

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

Sidebar

Related Questions

This is a simple problem but cannot find any working solution for it. I
I have problem I cannot find a solution for: basically I would like how
I cannot find the solution in the docs for this simple problem. I want
I've searched google and cannot find any answers to the particular problem. I have
I have a very simple problem but cannot find a nice solution. I have
I cannot find the solution for this problem, here is the simplified example: On
I have this problem and i just cannot find a solution to it. I
I've got this problem for a while now and I cannot find a solution
I've read the related questions but I cannot find one that suits my problem(or
I have searched the web but I cannot find the solution to my problem.

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.