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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:19:52+00:00 2026-06-17T11:19:52+00:00

I want to validate a value from html form in JavaScript function, the format

  • 0

I want to validate a value from html form in JavaScript function, the format is a bit flexible.

i.e,

1 or 2 or 3 or 4 or 5 integer value followed by back slash(/) followed by 1 or 2 or 3 integers.

Example.

12345/123 is a valid value.

1234/12 is a valid value.

123/123 is a valid value.

1/1 is a valid value.

a/123 is NOT a valid value.

123/% in NOT a valid value.

  • 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-17T11:19:54+00:00Added an answer on June 17, 2026 at 11:19 am

    You can try this regex: ^\d{1,5}\/\d{1,3}$

    Example:

    var re = /^\d{1,5}\/\d{1,3}$/;
    
    console.log(re.test('12345/123')); // true
    console.log(re.test('1234/12')); // true
    console.log(re.test('123/1')); // true
    console.log(re.test('12/123')); // true
    console.log(re.test('1/123')); // true
    console.log(re.test('a/123')); // false
    console.log(re.test('123456/123'); // false
    

    That said, you should start from the basics:

    http://en.wikipedia.org/wiki/Regular_expression

    http://www.regular-expressions.info/

    https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp

    Here you can find many examples: http://regexlib.com/?AspxAutoDetectCookieSupport=1

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

Sidebar

Related Questions

I want to post some values from a simple HTML form, validate them with
I want to write a function which can validate a given value (passed as
I have a <p:inputText> that I want to validate depending on the value from
I want to validate a form fields (text) input. It should only be a
i want to transform some xml into HTML that has the following format: <TR><TD>
I have a html form that I process with a aspx page. I want
I want to validate a form such that I can check the basics (such
I have a form implemented from hook_form called simplequiz_form() I want to access its
I am trying to execute a javascript function from a PHP script by sending
I want to validate the input field 'putime' in the form because even if

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.