title: How to check if a string contains only specifc characters using regex
body: <p>I have a long string of digits in Java. I want to find of the string contains any one of the digits 0,1,4,6,8,9 or not. <em>I do not want to check if my string contains just any random digits or not.</em></p>
  
  <p>I don't care how many times the digit is present. If any one of the above digits is present in the string even once, I want to stop right there and return true.</p>
  
  <p>what regex can be used to match this string?</p>
  
  <p>Is there any faster way to do it instead of using regex?
  I am using Java 8.</p>
  
  <p><strong>EDIT</strong>: I already found lots solutions online for checking if a string contains digits or not. Those solutions don't work here because I want to <strong>optimally</strong> find out if my string (of length~10^15 characters) contains specific digits or not.</p>