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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:40:10+00:00 2026-05-31T01:40:10+00:00

I have some form numbers I need to validate. I’ve tried multiple attempts but

  • 0

I have some form numbers I need to validate. I’ve tried multiple attempts but am not getting it right yet. While much is allowed in a form number there are some limits I need to impose:

All of these rules should be enforced:

  • A-Z allowed but not required (see bullet 4)
  • 0-9 allowed but not required (see bullet 4)
  • period (decimal point) and dash, if present, only allowed once per form number . –
  • Minimum length is one character and it cannot be a space, dash or period
  • multiple spaces are allowed but two spaces may not be next to each other; also no leading or trailing spaces are allowed

This is what I had before but not all the above rules were enforced.

[A-Z0-9]([A-Za-z0-9 -.])*[A-Z0-9]

So these would be examples of valid form numbers under the new requirements:

123 
123 456 
A1 IL 23 MN 
CL-100 2.0 

These would be examples of invalid form numbers under the new requirements:

123   456
25! 25
25-IL 30-1
aa bb CC
  • 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-31T01:40:11+00:00Added an answer on May 31, 2026 at 1:40 am

    This should work

    ^([A-Z0-9]|(?! )(?!.* $)(?!.*  )(?!.*-.*-)(?!.*\..*\.)(?![.-]$)[A-Z0-9 .-]+)$
    

    There are two parts. The first one [A-Z0-9] checks for a single character. If it isn’t a single character then there are some exclusion rules (?! )(?!.* $)(?!.* )(?!.*-.*-)(?!.*\..*\.)(?![.-]$) (in order): no beginning with space, no ending with space, no consecutive double spaces, no two -, no two ., no single character . or - followed by end-of-string. Then there is the “base” pattern (one or more of) [A-Z0-9 .-]+

    Note that you’ll have to escape the \ with another \, so \\.

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

Sidebar

Related Questions

I have some inputs that I need to process from a form. The #
I need some help with floating point numbers...please! Here's the thing, I have code
I have several strings in the rough form: [some text] [some number] [some more
Please help! I have some form elements in a div on a page: <div
I have some data of the form Key ID Link 1 MASTER 123 2
I have some javascript which catches changes to a form then calls the form's
I have some webserver resources protected with Form based Authentication. The requirement is to
i have one form which have some input box and some select box. i
I have some AJAX work that brings across an additional form element that I
I have some problems sending an id though jquery. I have a form select

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.