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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:34:33+00:00 2026-06-14T10:34:33+00:00

Im using C# and wanting to use the following regular expression in my code:

  • 0

Im using C# and wanting to use the following regular expression in my code:

sDatabaseServer\s*=\s*"([^"]*)"

I have placed it in my code as:

Regex databaseServer = new Regex(@"sDatabaseServer\s*=\s*"([^"]*)"", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);

I know you have to escape all parenthesis and quotes inside the string quotes but for some reason the following does still not work:

Working Version:

Regex databaseServer = new Regex(@"sDatabaseServer\s*=\s*""([^""]*)""", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);

Any ideas how to get C# to see my regex as just a string? I know i know….easy question…Sorry im still somewhat of an amateur to C#…

SOLVED: Thanks guys!

  • 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-14T10:34:34+00:00Added an answer on June 14, 2026 at 10:34 am

    You went one step too far when you escaped the parentheses. If you want them to be regex meta-characters (i.e. a capturing group), then you must not escape them. Otherwise they will match literal parentheses.

    So this is probably what you are looking for:

    @"sDatabaseServer\s*=\s*""([^""]*)"""
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using GridBagLayout to place my GUI components by the following code, wanting the
I'm using scrollto, and I'm wanting to have a class added when it scrolls
I am using JqueryUi tab control and I am wanting to have the same
Ok, Wanting to MVVM an existing app. The code behind contains the following: private
My problem is the following. I have a website that I'm creating and wanting
I am trying to use the following code to write out all processes started
Basically I have the following code: import multiprocessing import time class MyProcess(multiprocessing.Process): def __init__(self,
I'm using the following tester to try and figure out this regex: http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx My
We're using Castle Windsor 2.1.0.6655. I'm wanting to use transient lifecycle for my resolved
I'm new to Clojure and I'm wanting to use Clojure core.match: https://github.com/clojure/core.match I've setup

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.