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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:35:10+00:00 2026-06-11T14:35:10+00:00

I am using JQuery Validation Engine library. I am trying to create a custom

  • 0

I am using JQuery Validation Engine library. I am trying to create a custom validation either through Regex or custom method to validate the field input.

I would suggest this validation name as custom integer validation containing integer range or some integers separated by comma(s) or combination of both.

Here is the criteria:

  1. can enter any integer. For e.g. 89
  2. can enter any integer range. For e.g. 12-18 or 15-18 but not 19-3 (range should between min to max)
  3. can enter any combination of above two inputs separated by comma(,) only with or without spaces between comma. For e.g. 1-6, 5, 8-13, 7. But not -3-5 (not -3) or 3-7-, 10 (not 7-)

I tried this custom rule:

"integerRangeComma": {                    
             "regex": /^(([0-9]+)([\,]([0-9]+))?|([\,]([0-9]+))?)$/,
             "alertText": "* Invalid floating decimal number"
          },

My intended purpose to do the above validation is:

I have a list of total documents lets suppose 12. I created a text-box in the form to accept what document no, he likes to add in his profile. And the above criteria should be applied on that.

My next question would be, I also must validate that numbers entered by user do not greater than 12 (my presumption).

How can I achieve this either through creating my own custom rule or something else.

Thanks in Advance.

  • 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-11T14:35:11+00:00Added an answer on June 11, 2026 at 2:35 pm

    Doing maths with regex is always a pain, you should parse it and check the not greater than 12 condition with code. However, it is possible for this simple example by using

    [0-9]|1[12]
    

    Your combination for an input of a single integer or a range will then be

    number(-number)?
    

    and for one input, or two commaseparated ones is

    input(\s*,\s*input)?
    

    If you want more than two, use * for unlimited or {0,n} for limited repetion instead of the ?.

    So together, you get

    var integerRangeComma = {                    
         "regex": /^([0-9]|1[12])(-[0-9]|-1[12])?(\s*,\s*([0-9]|1[12])(-[0-9]|-1[12])?)?$/,
         "alertText": "a single page number until 12 or an interval in them, or two of those separated by a comma"
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using this validation plugin: https://github.com/posabsolute/jQuery-Validation-Engine The email input field i have should validate
I am using jquery validation plugin to validate my form. I have one field
I am using jquery validation plugin to validate a registration form. Each text input
Possible Duplicate: Javascript date regex DD/MM/YYYY i'm using this validation :- jquery validation engine
Using jquery validation: http://docs.jquery.com/Plugins/Validation I am also validating each field on blur: //validate each
Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
I'm using the jQuery Validation Engine to validate some form fields. Everything's working well
I'm using the jQuery Validation Engine . I want the erroneous form field to
I am using jquery validate engine plugin. I got the validation right so the
I'm using the native jQuery validation library to validate email addresses entered in 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.