title: Difference between regular expression modifiers (or flags) 'm' and 's'?
body: <p>I often forget about the regular expression modifiers <code>m</code> and <code>s</code> and their differences. What is a good way to remember them?</p>
  
  <p>As I understand them, they are:</p>
  
  <blockquote>
    <p>'m' is for multiline, so that <code>^</code> and <code>$</code>
    will match beginning of string and end
    of string multiple times.  (as divided
    by <code>\n</code>)</p>
    
    <p>'s' is so that the dot will match even
    the newline character</p>
  </blockquote>
  
  <p>Often, I just use   </p>
  
  <pre><code>/some_pattern/ism
  </code></pre>
  
  <p>But it probably is better to use them accordingly (usually "s" in my cases).</p>
  
  <p>What do you think can be a good way to remember them, instead of forgetting which is which every time?</p>