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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:54:31+00:00 2026-06-02T07:54:31+00:00

As others recommended create a whitelist but I really wanted to create a blacklist.

  • 0

As others recommended “create a whitelist” but I really wanted to create a blacklist.
this is my code

if($("#txtTag").val().length <=0 || $("#txtTag").val() =="")
{
    $("#ep-insert-keyword").html("Please Enter Keyword");
    $("#ep-insert-keyword").fadeIn("normal");
}
else if(!RegexCheck(/^[a-zA-Z\_]+$/g,$("#txtTag").val()))
{
    $("#ep-insert-keyword").html("Special characters are not allowed");
    $("#ep-insert-keyword").fadeIn("normal");
}

I want to prevent my users to enter any special character I defined in my regex.
the characters i want to prevent are this ranges of characters in ASCII

0-47 58-64 91-96 123-127

I really want to reverse my code from whitelist to BLACKLIST… but i don’t know how.

I don’t worry about other languages as i really want them to pass my validation… i just want to block the characters on the ASCII ranges i wanted

  • 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-02T07:54:31+00:00Added an answer on June 2, 2026 at 7:54 am

    Though I’m with the others and recommend a whitelist, here’s how you would do a blacklist using a regex:

    // 0-47 : 00-2F : control codes, spaces, punctuation
    // 58-64 : 3A-40 : more punctuation
    // 91-96 : 5B-60
    // 123-127 : 7B-7F
    
    function verifyChars(str) {
        return str.match(/^[^\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+$/) != null;
    }
    

    And here’s a jsFiddle with a bunch of test cases in it: http://jsfiddle.net/jfriend00/24xF7/

    Or a little more efficient (because it only evaluates the regex once at startup and uses .test()):

    var verifyChars = (function() {
        var re = /^[^\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+$/;
        return function(str) {
            return re.test(str);
        }
    })();
    

    jsFiddle of this one with test cases: http://jsfiddle.net/jfriend00/fZ3AN/

    FYI, here’s a good reference on how to put unprintable chars into a regex: http://www.regular-expressions.info/characters.html

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

Sidebar

Related Questions

I'm sure others have already asked this, but is it possible to insert an
I have two checkboxes (Recommended and Others) which have peoples names (concatenated, i.e. John
I wanted others to explain to me, which approach is better: using a session
searched this site and others - no joy. :: first for loop for /L
I'm curious how others have solved this problem, and what problems might lurk behind
Is there a way to force a logoff (knowing this is not recommended) of
Which would be the most recommended python hybrid to create GUI application? I have
If this is recommended ? Can I ask some git command examples about how
I opend a post about this before but I feel that I can now
There is a ton of information on how to do this, but since there

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.