title: How can I replace all occurrences of a substring using regex?
body: <p>I have a string, <code>s = 'sdfjoiweng%@$foo$fsoifjoi'</code>, and I would like to replace <code>'foo'</code> with <code>'bar'</code>. </p>
  
  <p>I tried <code>re.sub(r'\bfoo\b', 'bar', s)</code> and <code>re.sub(r'[foo]', 'bar', s)</code>, but it doesn't do anything. What am I doing wrong?</p>