Popular recipes tagged "uniform"http://code.activestate.com/recipes/tags/uniform/2009-05-06T06:17:16-07:00ActiveState Code Recipesuniform matcher( "re pattern" / re / func / dict / list / tuple / set ) (Python)
2009-05-06T06:17:16-07:00denishttp://code.activestate.com/recipes/users/4168005/http://code.activestate.com/recipes/576741-uniform-matcher-re-pattern-re-func-dict-list-tuple/
<p style="color: grey">
Python
recipe 576741
by <a href="/recipes/users/4168005/">denis</a>
(<a href="/recipes/tags/grep/">grep</a>, <a href="/recipes/tags/re/">re</a>, <a href="/recipes/tags/text_processing/">text_processing</a>, <a href="/recipes/tags/uniform/">uniform</a>).
Revision 2.
</p>
<p>matcher() makes a string matcher function from any of:</p>
<ul>
<li>"RE pattern string"</li>
<li>re.compile()</li>
<li>a function, i.e. callable</li>
<li>a dict / list / tuple / set / container</li>
</ul>
<p>This uniformity is simple, useful, a Good Thing.</p>
<p>A few example functions using matchers are here too: grep getfields kwgrep.</p>