title: Regex for Curly braces Number Curly brace ({n}) in Java
body: <p>I am trying to write a simple regex , but i don't know where am I going wrong . I need to check whether a string has a curly brace number curly brace.  </p>
  
  <p>Eg: Consider the string<br>
      Swapstream{2} - true<br>
      Swapstram - false                   </p>
  
  <pre><code>Pattern pattern=Pattern.compile("\\{[0-9]\\}");
  Matcher matcher=pattern.matcher(input);
  if(matcher.matches())
  {\\logic}
  </code></pre>
  
  <p>Also I tried writing \d instead of [0-9] , still the string is not matching.
  Please help ! . Thanks</p>