title: Python Regex: "re.match()" works differently than "re.sub()" for regex
body: <p>I am trying to check if my string contains some regular expression.</p>
  
  <p>The strange thing is is, that while <code>re.sub()</code> would find the regex and will replace it, <code>re.match()</code> does not return any results...</p>
  
  <p>Here is my usage:</p>
  
  <p><strong>re.match()</strong>: - trying to match the pattern <code>,\s*param2</code> - nothing is returned</p>
  
  <pre><code>&gt;&gt;&gt; str = 'func(param1, param2)'
  &gt;&gt;&gt; str
  'func(param1, param2)'
  &gt;&gt;&gt; results = re.match(r',\s*param2', str)
  &gt;&gt;&gt; print(results)
  None
  </code></pre>
  
  <p><strong>re.sub()</strong>: - Successfully replacing the same pattern <code>,\s*param2</code> by " hello"</p>
  
  <pre><code>&gt;&gt;&gt; str = 'func(param1, param2)'
  &gt;&gt;&gt; str
  'func(param1, param2)'
  &gt;&gt;&gt; new_str = re.sub(r',\s*param2', ' hello', str)
  &gt;&gt;&gt; new_str
  'func(param1 hello)'
  </code></pre>
  
  <p>How can I match the pattern <code>,\s*param2</code> without substituting it?</p>