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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:36:08+00:00 2026-05-23T14:36:08+00:00

How do I use regular expressions in CSS? I found a tutorial here for

  • 0

How do I use regular expressions in CSS? I found a tutorial here for matching static strings in CSS, but I haven’t been able to find one for using regular expressions to match multiple strings in CSS. (I found one here, but I couldn’t get it to work. I also looked at the W3C documentation on using regular expressions, but I couldn’t make sense of the document.)

I’m want to match a series of <DIV> tags whose ids start at s1 and increase by one (ie. #s1 #s2 #s3…).

I know that div[id^=s], div[id^='s'], and div[id^='s'] each perform the match as I intend it in my CSS. However, each of those also match an id of #section, which I don’t want to happen. I believe that "/^s([0-9])+$/" is the equivalent PHP string–I’m just looking for it in CSS version.

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

    There is no way to match elements with a regular expression, even in CSS3. Your best option is probably to simply use a class for your divs.

    <style>
    .s-div {
        // stuff specific to each div
    }
    </style>
    
    <div id="s1" class="s-div"><!-- stuff --></div>
    <div id="s2" class="s-div"><!-- stuff --></div>
    <div id="s3" class="s-div"><!-- stuff --></div>
    <div id="s4" class="s-div"><!-- stuff --></div>
    <div id="s5" class="s-div"><!-- stuff --></div>
    

    Also remember that you can separate multiple class names by a space inside a class attribute.

    <div class="class1 class2 class3"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use regular expressions (Perl compatible) to be able to find a
I am trying to use regular expressions to do some work on strings but
I am trying to use regular expressions to find a UK postcode within a
I generally stay away from regular expressions because I seldom find a good use
Duplicate of: There is a function to use pattern matching (using regular expressions) in
I'm trying to use regular expressions in R to find one or more phrases
I'm trying to use regular expressions to find three or more of the same
I want to use regular expressions for analyzing a url, but I can't get
VS2008 allows you to use regular expressions in the find/replace dialogs. I've run into
I'd like to use regular expressions in selecting elements using the match function. I'd

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.