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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:01:11+00:00 2026-05-25T21:01:11+00:00

I have trouble finding a regex matching this pattern: A numeric (decimal separator can

  • 0

I have trouble finding a regex matching this pattern:

  • A numeric (decimal separator can be . or ,), followed by
  • a dash -, followed by
  • a numeric (decimal separator can be . or ,), followed by
  • a semi-column or a space character

This pattern can be repeated one or more time.

The following examples should match the regex:

1-2;
1-2;3-4;5-6;
1,0-2;
1.0-2;
1,0-2.0;
1-2 3-4;
1-2 3,00-4;5.0-6;

The following examples should not match the regex:

1-2
1 2;
1_2;
1-2;3-4
  • 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-25T21:01:12+00:00Added an answer on May 25, 2026 at 9:01 pm

    Edit updated based on moving of 1 2; to non-match.


    This should work:

    @"^(\d+([,.]\d+)?-\d+([,.]\d+)?[ ;])+(?<=;)$"
    

    Explanation

    ^              //Start of the string.
    (              //Start of group to be repeated. You can also use (?=
    \d+            //One or more digits.
    ([,.]\d+)?     //With an optional decimal
    -              //Separated by a dash
    \d+([,.]\d+)?  //Same as before.
    [ ;]           //Terminated by a semi-colon or a space
    )+             //One or more of these groups.
    (?<=;)         //The last char before the end needs to be a semi-colon
    $              //End of string.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble finding way to correctly refactor this code so that there would
This question may have been asked before, but I had trouble finding an answer,
I have trouble with finding my SQLite Database. As we can access the SQLite
I'm having trouble finding a nice elegant ruby way to do this. I have
I'm having trouble finding a solution to this via google but I would have
This question seems easy but for some reason I have trouble finding the answer.
I'm having trouble finding a definite specification of this in the standard. I have
I have some trouble finding this. Actually I want to unregister / cancel all
I'm having trouble finding a list of the changes and bug fixes that have
I'm having trouble finding/getting any logging output from a web service. I have a

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.