title: Python regex, searching for prefixes inside a target string
body: <p>I need to find a <strong>list of prefixes</strong> of words inside a <strong>target string</strong> (I would like to have the list of matching indexes in the target string handled as an array).</p>
  
  <ul>
  <li>I think using <strong>regex</strong> should be the cleanest way.</li>
  <li>Given that I am looking for the pattern "foo", I would like to retrieve in the target string words like "foo", "Foo", "fooing", "Fooing"</li>
  <li>Given that I am looking for the pattern "foo bar", I would like to retrieve in the target string patterns like "foo bar", "Foo bar", "foo Bar", "foo baring" (they are still all handled as prefixes, am I right?)</li>
  </ul>
  
  <p>At the moment, after running it in different scenarios, my Python code still does not work.</p>
  
  <ul>
  <li>I am assuming I have to use <strong>^</strong> to match the <strong>beginning of a word</strong> in a target string (i.e. a prefix).</li>
  <li>I am assuming I have to use something like <strong>^[fF]</strong> to be <strong>case insensitive with the first letter of my prefix</strong>.</li>
  <li>I am assuming I should use something like <strong>".*"</strong> to let the regexp behave like a <strong>prefix</strong>.</li>
  <li>I am assuming I should use the <strong>\prefix1|prefix2|prefix3** to put in **logic OR many different prefixes</strong> in the pattern to search.</li>
  </ul>
  
  <p>The following source code does not work because I am wrongly setting the <code>txt_pattern</code>.</p>
  
  <pre><code>import re
  
  #              '            '           '            '                     '             '           '
  txt_str = "edb foooooo jkds Fooooooo kj fooing jdcnj Fooing ujndn ggng sxk foo baring sh foo Bar djw Foo";
  txt_pattern = ''#???
  
  out_obj = re.match(txt_pattern,txt_str)
  if out_obj:
     print "match!"
  else:
     print "No match!"
  </code></pre>
  
  <ol>
  <li><p>What am I missing?</p></li>
  <li><p>How should I set the <code>txt_pattern</code>?</p></li>
  <li><p>Can you please suggest me a good <strong>tutorial</strong> with <strong>minimum working examples</strong>? At the moment the standard tutorials from the first page of a Google search are very long and detailed, and not so simple to understand.</p></li>
  </ol>
  
  <p>Thanks!</p>