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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:16:05+00:00 2026-06-03T07:16:05+00:00

The id attribute values in HTML 5 has the following rules 1.The string should

  • 0

The id attribute values in HTML 5 has the following rules

1.The string should contain nonwhitespace characters
2. It should contain at least one letter

How can i represent this in regular expression form.I reached in a regular expression which satisfies the first condition..

/(^|\s)\S+/ig

But how can i indicate the second condition in to the above regular expression
…and I am new to regular expressions…

  • 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-03T07:16:07+00:00Added an answer on June 3, 2026 at 7:16 am

    You have got your restrictions wrong. The HTML5 ID data type must:

    • must be at least one character long
    • must not contain any space characters

    That’s:

    ^\S+$
    

    Done.

    Note:

    • Without any characters in your regex (\S is not a character), you don’t have to make your regex case-insensitive (/.../i is superfluous).
    • Since your regex is anchored (^...$) there can only ever be a single match. This means there is no need for the “global” modifier, so /.../g is superfluous as well.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can one call a ColdFusion function, passing in attribute values as arguments, inside
Usually HTML element attribute values are marked with a quotation mark, like <input type=hidden
Possible Duplicate: What are valid values for the id attribute in HTML? Underscores seem
I want to get all values of 'id' attribute of 'span' tag with html
HI, I want to find all input elements in a HTML string that has
How do I go on about selecting elements which has the same attribute values
I would like to convert some value from a XML attribute into valid HTML
I try to retrieve a list of the attribute values of the children of
What are the valid values for the eventName attribute when configuring Health Monitoring? <system.web>
Is there a way to exclude a list of values for an object attribute

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.