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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:34:31+00:00 2026-06-11T04:34:31+00:00

A continuation of my previous question … After testing the text format, if it

  • 0

A continuation of my previous question…

After testing the text format, if it is not the correct format I would like to figure out which pairs of hex values are incorrect (i.e. any pair that contains value(s) other than[0-9A-Fa-f]).

if( validFormat ) {
// do processing
}
else {
// find invalid hex value pairs
}

What is the most efficient way to obtain a list of incorrect(invalid) hex pairs so that I can report back the errors and their associated hex pairs.

Edit for additional question

Also, how would I go about testing to ensure there is not a “double space” anywhere, because that also constitutes for invalid format even though the hex pairs may be valid.

Thanks!

  • 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-11T04:34:32+00:00Added an answer on June 11, 2026 at 4:34 am

    The easiest is to find all values and scan for those that are not valid:

    var isHexPair = /^[0-9a-f]{2}$/i;
    var allPairs = myTextArea.value.split(/\s+/);
    var notHex   = [];
    for (var i=allPairs.length;i--;){
      if (!isHexPair.test(allPairs[i])){
        notHex.push(allPairs(i));
      }
    }
    

    That regex says:

    • ^ starting at the beginning of the string
    • [0-9a-f] find any character that is a digit or a-f
    • {2} find exactly two of them
    • $ making sure that we are now at the end of the string
    • i and make it case-insensitive (allow A-F as well as a-f)

    With the above you can then do:

    if (notHex.length){
      // There is at least one invalid entry
    }else{
      // all is well
    }
    

    Edit: If you explicitly want to test that the string contains nothing but single-byte hex strings separated by a single space, the simplest test would just be:

    if (/^([0-9a-f]{2} )+[0-9a-f]{2}$/i.test(myStr)){ /* valid! */ }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In continuation to my previous question , I would like to ask the following
This question is in continuation to my previous question, in which I asked about
This is in continuation to my previous question which was closed cause of similarity
This is a continuation of my previous question which I posted when I wasn't
This is a continuation of my previous question: Could not find an implementation of
This is the continuation of my previous question. deleting lines from text files based
This question is a continuation of my previous question here zend models architecture (big
This question is in continuation to my previous question . I am trying to
This is a continuation of my previous question .NET regex engine returns no matches
This is a continuation from a previous stackoverflow question. I've renamed some variables so

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.