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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:37:10+00:00 2026-06-09T08:37:10+00:00

I am looking for a regular expression in C# to match any of these

  • 0

I am looking for a regular expression in C# to match any of these strings: “+99.99”, “-99.99”, “99.99”. The same regular expression should not match the string “+-99.99”. Can any one please suggest an answer.

  • 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-09T08:37:11+00:00Added an answer on June 9, 2026 at 8:37 am

    The following worked for me:

            String regex = "^(\\+|-)?99\\.99$";
            String str1 = "-99.99";
            String str2 = "+99.99";
            String str3 = "99.99";
            String str4 = "+-99.99";
    
            System.Console.WriteLine(Regex.IsMatch(str1, regex));
            System.Console.WriteLine(Regex.IsMatch(str2, regex));
            System.Console.WriteLine(Regex.IsMatch(str3, regex));
            System.Console.WriteLine(Regex.IsMatch(str4, regex));
    
            System.Console.ReadKey();
    

    Yielded:

    True True True False

    Explanation: ^ will instruct the regex engine to start matching from the beginning of the string, (\\+|-) denotes a + or - character. The + is a special character in regex syntax and thus needs to be escaped. The OR operator is denoted by the | character.

    The ? denotes that the + or - character may or may not be there (it will match 0 or 1 instances of whatever preceeds it).

    99\\.99 denotes the string 99.99. The . is also a special character in regex syntax and thus needs to be escaped. The $ character will instruct the regex engine to stop matching at the end of the string.

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

Sidebar

Related Questions

Hi guys I am looking for a regular expression which will not match any
I'm looking for a simple regular expression to match the same character being repeated
This regular expression is only returning one match. (I'm looking to retrieve all image
I am looking for a regular expression that will match any number from 1
I'm looking for a regular expression that which will match a string ##test## in
I'm looking at a regular expression to match any characters. I know that the
I'm looking for a regular expression that can find the alpha representation of a
Looking for a regular expression that match the following relative URLs: All urls starts
I'm looking for a regular expression to match every new line character ( \n
I'm looking for a regular expression that will check whether or not delimiters in

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.