0

Given I have

div#my_id_1
div#my_id_2
div#my_id_3

How do I write a CSS selector that matches all divs with id my_id_n?

With regex if I want to match my_id_n I can do /my_id_\d+/ to match my_id_n. What's the equivalent here?

TylerH
  • 20,799
  • 66
  • 75
  • 101
David West
  • 2,256
  • 6
  • 32
  • 62
  • 1
    See also [CSS selector (id contains part of text)](https://stackoverflow.com/questions/12155833/css-selector-id-contains-part-of-text) – TylerH May 31 '18 at 21:21
  • 1
    Do note the advice on [the answer to CSS select elements with partial id](https://stackoverflow.com/a/13533508) (from [BoltClock](https://stackoverflow.com/users/106224/boltclock)): "...why not add a common class to each group of elements and select by that class to make things simpler?" – Heretic Monkey May 31 '18 at 21:48
  • @TylerH make that an answer and I'll pick it. – David West Jun 01 '18 at 19:24
  • @DavidWest It's a duplicate, so the appropriate system action is what has already happened; the question is closed so that it can serve to point others toward that Q&A set. – TylerH Jun 01 '18 at 19:43

0 Answers0