title: Regex for checking the last character
body: <p>How can I check if the last character of a string is <code>' '</code> or <code>','</code>?</p>
  
  <p>I know for checking last character of string we need use <code>$</code>, and I made this regex for checking that the last character is <code>','</code>: </p>
  
  <pre><code>/\,$/
  </code></pre>
  
  <p>But I also need to check whether it's a space or not.</p>
  
  <p>It will be very helpful if you give suggestion for making a regex like this.</p>