JSFiddle - React, Tailwind, and code Playground

HTML

<div id="q1q4">
    test
</div>
<div id="q2q4">
    test
</div>

<div id="q1q5">
    test
</div>

<div id="qrst">
    test
</div>

CSS

[id^=q]:not(#qrst) {
  color: green;
}