title: Ruby regex anchors combined with character class &&
body: <p>I am trying to match a string containing printable ascii without some special characters, for example the character 'x'. I use this regex <code>/[.&amp;&amp;[^x]]/</code> for this task.</p>
  <p>When trying to match if the whole string is made from this character specification the regex doesn't match any more. <code>/^[.&amp;&amp;[^x]]*$/</code></p>
  <p>Trying this with the normal dot works however.
  <code>/^.*$/</code> matches every string i throw at it.</p>
  <p>I'm using Ruby 2.7.2</p>
  <p>The regex is constructed at runtime and the <code>/^ ... $/</code> anchors are needed for other edge cases.</p>