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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:02:46+00:00 2026-05-25T22:02:46+00:00

How to validate using Javascript an input tag of type text in an html

  • 0

How to validate using Javascript an input tag of type text in an html form that the content of it will be one of the following:-

  • Arabic or English Characters ONLY -OR-
  • Arabic and English Characters ONLY -OR-
  • Arabic characters only -OR-
  • English Characters only -OR-
  • Number only -OR-
  • Arabic Characters and Number only -OR-
  • English Characters and Number only -OR-
  • Arabic or Number ONLY -OR-
  • English Characters or Number ONLY -OR-
  • Arabic or English Characters or Number ONLY -OR-
  • Phone Number -OR-
  • Email -OR-
  • English string that starts with specific character like ‘A’ -OR-
  • English string that ends with specific character like ‘A’ -OR-
  • English string that contains specific character like ‘A’ -OR-
  • English string that does not contain specific character like ‘A’

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-05-25T22:02:47+00:00Added an answer on May 25, 2026 at 10:02 pm

    First, I need a definition of “English”, “Arabic” and “Numbers” characters.

    1. The definition of the English character boundary should at least include a-z, A-Z. Non-word characters (comma, dot, parentheses) should also be included, but since you didn’t specify the purpose of your validation, I will limit these to a-z, A-Z.
      English RegExp: [a-zA-Z]
    2. I’m not skilled in the Arabian language, so I grab include all characters as definied at this source.
      RegExp: /[\u0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]/
    3. The numbers are defined as \d (in JavaScript: 0-9).
      RegExp: \d (equals [0-9] in JavaScript)
    4. The beginning and the end of a string are matched by a ^ and $, using Regular expressions.

    Brought together:

    • Arabic and/or English Characters ONLY -OR-
      /^[a-zA-Z\u0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]+$
    • Arabic characters only -OR-
      /^[\u0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]+$/
    • English Characters only -OR-
      /^[a-zA-Z]+$/
    • Number only -OR-
      /^\d+$/
    • Arabic Characters and/or Number only -OR-
      /^[\du0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]+$
    • English Characters and/or Number only -OR-
      /^[\dA-Za-z]+$/
    • Arabic and/or English Characters and/or Number ONLY -OR-
      /^[a-zA-Z\d\u0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]+$/
    • Phone Number -OR- Phone numbers are too locale-dependent, construct your own RE
    • Email -OR-
      ^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$ source 2 (very basic mail RegExp)
    • English string that starts with specific character like ‘A’ -OR-
      /^A/
    • English string that ends with specific character like ‘A’ -OR-
      /A$/
    • English string that contains specific character like ‘A’ -OR-
      /A/
    • English string that does not contain specific character like ‘A’
      ^[^A]+$

    Of course, the English character set should include more characters than a-zA-Z if you’re validating sentences. I recommend to use [\x20-\x7e] instead of [a-zA-Z], so commonly used punctuation characters are also available.


    References / See also

    • MDN: Regular expressions – A guide to use Regular Expressions in JavaScript
    • Regulsr Expressions.info – Summary of character boundaries
    • UTF8-chartable.de – Browser through all characters
    • Unicode.org/charts – An official reference which documents all boundaries in a deeper detail
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery.validate plugin and facing the following situation: <form id=myForm ....> <input type=text
I am using the following javascript for form validation: <script type=text/javascript> function validate_form (
I'm using the following lines of JavaScript to validate an input as a valid
I have a form that I validate it using the JavaScript. Now when I
I have a textfield <input type=text/> that I want to validate when the focus
I'm using the following regexp to validate numbers in my javascript file: var valid
I am using javascript to validate user input on my aspx page. I am
I'm using javascript to validate the form, but can't handle the case when the
I am using jQuery validate to validate a form. I have two text boxes
I have a simple form with fields that I am trying to validate using

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.