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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:18:46+00:00 2026-05-15T00:18:46+00:00

I am trying to use a regular expression validation to check for only decimal

  • 0

I am trying to use a regular expression validation to check for only decimal values or numeric values. But user enters numeric value, it don’t be first digit “0”

How do I do that?

  • 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-15T00:18:47+00:00Added an answer on May 15, 2026 at 12:18 am

    A digit in the range 1-9 followed by zero or more other digits:

    ^[1-9]\d*$
    

    To allow numbers with an optional decimal point followed by digits. A digit in the range 1-9 followed by zero or more other digits then optionally followed by a decimal point followed by at least 1 digit:

    ^[1-9]\d*(\.\d+)?$
    

    Notes:

    • The ^ and $ anchor to the start and end basically saying that the whole string must match the pattern

    • ()? matches 0 or 1 of the whole thing between the brackets

    Update to handle commas:

    In regular expressions . has a special meaning – match any single character. To match literally a . in a string you need to escape the . using \. This is the meaning of the \. in the regexp above. So if you want to use comma instead the pattern is simply:

    ^[1-9]\d*(,\d+)?$
    

    Further update to handle commas and full stops

    If you want to allow a . between groups of digits and a , between the integral and the fractional parts then try:

    ^[1-9]\d{0,2}(\.\d{3})*(,\d+)?$
    

    i.e. this is a digit in the range 1-9 followed by up to 2 other digits then zero or more groups of a full stop followed by 3 digits then optionally your comma and digits as before.

    If you want to allow a . anywhere between the digits then try:

    ^[1-9][\.\d]*(,\d+)?$
    

    i.e. a digit 1-9 followed by zero or more digits or full stops optionally followed by a comma and one or more digits.

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

Sidebar

Related Questions

I'm trying to use a regular expression validation using .match for email validation and
I'm trying to use this regular expression, but I'm having trouble testing it, because
I'm trying to use regular expression right now and I'm really confuse. I want
I am trying to use a regular expression with grep command of Linux (^\s*\*\s*\[
I'm trying to find a single regular expression that I can use to parse
I am trying to use regular expression to search a document fo a UUID
I am having problems trying to use the regular expression that I used in
Hi I am using razor and trying to use regular expression to validate email
I'm trying to use a regular expression to select all of each word except
I am trying to use a VBA regular expression to validate a time range

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.