title: Java String matches error with REGEX
body: <p>I have to split a String if it has this format below</p>
  
  <pre><code>String test="City: East Khasi Hills";
  </code></pre>
  
  <p>and some times i may get <code>String test="City:";</code></p>
  
  <p>I want to match the pattern if there is any words after ":", </p>
  
  <p>I am using </p>
  
  <pre><code>String city=test.matches(":(.*)")?test.split(":")[1].trim():"";
  </code></pre>
  
  <p>But my regex is returning false. tired of debugging by the way i am using <a href="https://regex101.com/" rel="nofollow">regex online tool</a> to test my string.</p>
  
  <p>I am getting a match in the tool. but java is returning me false.</p>