title: How to extract multiple regex matches from a string in java
body: <p>How do I form a regular expression to extract variables from a string which are of the format ${variable name}</p>
  
  <p>Lets say I have a string like this :</p>
  
  <pre><code>hello ${ person } welcome to ${ university name}. you are enrolled in ${class}
  </code></pre>
  
  <p>and I need to extract these from the string</p>
  
  <p>person , </p>
  
  <p>university name ,</p>
  
  <p>class</p>