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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:18:07+00:00 2026-06-13T09:18:07+00:00

I need to validate a string that contains a number (the number can’t be

  • 0

I need to validate a string that contains a number (the number can’t be 0 or have zeros at the begining) or a number followed by a single characters in the range a-z or A-Z. So, these are all valid

2, 12, 1, 324534A, 2Y, 934d

but these are all invalid

000R, 0, 0D, D3, 23432dddd, 234Q343.

Can someone show me the correct regex expression for this?

  • 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-13T09:18:08+00:00Added an answer on June 13, 2026 at 9:18 am

    This should match.

    ^[1-9]\d*[a-zA-Z]?$
    

    Breakdown:

    ^           - Match start of string
    [1-9]       - Followed by one digit (1-9), no 0
    \d*         - Followed by any number of digits (can contain digits from 
                  other cultures). If you want to constain use [0-9] instead of \d
    [a-zA-Z]?   - Followed by either one character or none
    $           - Followed by end of string
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to validate a string that contains XML Data, there is no schema
I need a regex or a function in PHP that will validate a string
I need to validate a user's screen name to make sure that it can
Really got stuck on this simple regex. Need it to validate a string, that
I have a tag like this <order>foo,bar,goo,doo,woo</order> that I need to validate with an
How can I validate that an element has specific attribute and attribute must have
I need to validate a user given String and validate that it is a
I need to validate input to my application. The input is a formatted string
I need to validate file name with following pattern.... File name(string) should not be
I need to validate the membership card number of a table to be unique

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.