title: Regular Expression to find annotations in single/multiline for Java class
body: <p>I want to develop a Regular Expression in Java to find annotations in single/multiline for Java class. Just now I am trying this one</p>
  
  <pre><code>String regExp = "^\\s*(@.+)$";
  </code></pre>
  
  <p>but it works on single line only, not working on multiline .e.g.</p>
  
  <pre><code>@NamedNativeQuery(name = "nativeSQL", query = "SELECT emp1.emp_id, emp1.name, emp1.manager_id, "
  + "emp1.dept_id, emp1.address_id " + "FROM EMP emp1, EMP emp2 "
  + "WHERE ((emp2.EMP_ID = ?) AND (emp2.EMP_ID = emp1.MANAGER_ID))", resultClass = Professor.class)
  </code></pre>
  
  <p>In the given example I want to extract the key-value pair e.g.</p>
  
  <pre><code>name = "nativeSQL"
  query = "SELECT emp1.emp_id, emp1.name, emp1.manager_id, "
  + "emp1.dept_id, emp1.addr
  </code></pre>