Python regular expression. Find a sentence in a sentence
<p>I'm trying to find an expression "K others" in a sentence "Chris and 34K others"</p>

<p>I tried with regular expression, but it doesn't work :(</p>

<pre><code>import re


value = "Chris and 34K others"

m = re.search("(.K.others.)", value)

if m:
    print "it is true"
else:
    print "it is not"
</code></pre>

<p>You should use <code>search</code> rather than <code>match</code> unless you expect your regular expression to match at the beginning. The help string for <code>re.match</code> mentions that the pattern is applied at the start of the string.</p>

python regex python-2.7