title: using regular expressions in groovy
body: <p>I don't understand how I should use regular expressions in <code>groovy</code> despite it having several operators to work with it.</p>
  
  <pre><code>import java.util.regex.*
  
  def line = "Line with 1 digits"
  
  Pattern p = Pattern.compile("\\d+")
  Matcher m = p.matcher(line)
  if (m.find()) { // true
      println "found digit"
  } else {
      println "not found digit"
  }
  
  if (line ==~ /\\d+/) { // false
      println "found"
  } else {
      println "not found"
  }
  
  if (line =~ /\\d+/) { // false
      println "found"
  } else {
      println "not found"
  }
  </code></pre>
  
  <p>In my example in <code>java</code> code it found that there is a digit in the string successfully. However in <code>groovy</code> it was not able to do it.</p>
  
  <p>What is wrong?</p>