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

  • Home
  • SEARCH
  • 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 6997473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:17:16+00:00 2026-05-27T20:17:16+00:00

I need to have ha validity test to see if input from a user

  • 0

I need to have ha validity test to see if input from a user is valid. I need to know if the user writes a valid hex color.

Input could be “FFTTAA” which would not be valid as TT is not hex. It then need to abort so it is not written to the file. My problem is that i do not know how to single out hex as it is both letters and numbers. Which means a simple [0-9] would not work.

read -p "Use light, normal or bold (ex. light): " ANS1; read -p "Write size in mm (ex. 1.8): " ANS2; read -p "Write color in hexadecimal (ex. FFFFFF): " ANS3;

sed -i '/SwipeLauncherButtonStyle {/,/text/c\
    SwipeLauncherButtonStyle {\
    font: \$FONT_FAMILY '"$ANS1"' '"$ANS2"'mm;\
    text-color: \#'"$ANS3"';' file.css
  • 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-27T20:17:17+00:00Added an answer on May 27, 2026 at 8:17 pm

    Instead of [0-9], use either [0-9A-F] (to allow only uppercase) or [0-9A-Fa-f] (to allow lowercase as well). For example:

    if ! [[ $ANSI3 =~ ^[0-9A-F]{6}$ ]] ; then
        # abort . . .
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need have a textbox where user can input latitude and longitude, eg. 51.499167,
I need to pull data from an xls, I also need have the user
I have need to select a number of 'master' rows from a table, also
I have need to return multiple results from a subquery and have been unable
I need to have a thread signal another if the user wishes to interrupt
On a recent project, I need have a hex mask (0x0 - 0xFF) as
We have need for a rating system in a project we are working on,
I have the following need I have a logging table which logs som leads
I have need to produce LINE, BAR, and PIE charts in Rails. I have
I have need to pack four signed bytes into 32-bit integral type. this is

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.