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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:00:54+00:00 2026-05-13T14:00:54+00:00

Greetings JavaScript and regular expression gurus, I want to return all matches in an

  • 0

Greetings JavaScript and regular expression gurus,

I want to return all matches in an input string that are 6-digit hexadecimal numbers with any amount of white space in between. For example, “333333 e1e1e1 f4f435” should return an array:

array[0] = 333333  
array[1] = e1e1e1  
array[2] = f4f435

Here is what I have, but it isn’t quite right– I’m not clear how to get the optional white space in there, and I’m only getting one match.

colorValuesArray = colorValues.match(/[0-9A-Fa-f]{6}/);

Thanks for your help,

-NorthK

  • 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-13T14:00:55+00:00Added an answer on May 13, 2026 at 2:00 pm

    Use the g flag to match globally:

    /[0-9A-Fa-f]{6}/g
    

    Another good enhancement would be adding word boundaries:

    /\b[0-9A-Fa-f]{6}\b/g
    

    If you like you could also set the i flag for case insensitive matching:

    /\b[0-9A-F]{6}\b/gi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings Rails and Javascript Gurus! I have a project where I am returning a
Greetings, I want to pop up the Jquery Datepick as the image is clicked
greetings all i have a domain class named car and i have an object
Greetings, After reading the following article I have a question: https://developer.mozilla.org/en/Introduction_to_Object-Oriented_JavaScript In the inheritance
Greetings, In an WPF DataGridTemplateColumn I have a CellTemplate using a ListView and a
Greetings, Here is my SConstruct file: env = Environment() env.Append(CCFLAGS=['-g','-pg']) env.Program(target='program1', source= ['program1.c']) Also
Greetings, I have a complicated scenario to handle. I have a wsdl file which
Greetings, creating my first MVVM based WPF app and trying to figure out why
Greetings, I am changing the width of an element which serves as a bar
Greetings Everyone I am new in asp.net and i'm using RadControls for Asp.net Ajax

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.