Popular recipes tagged "string_substitution"http://code.activestate.com/recipes/tags/string_substitution/2009-04-03T13:38:39-07:00ActiveState Code RecipesMulti-Regex: Single pass replace of multiple regexes (Python) 2009-04-03T13:38:39-07:00Michael Palmerhttp://code.activestate.com/recipes/users/1827292/http://code.activestate.com/recipes/576710-multi-regex-single-pass-replace-of-multiple-regexe/ <p style="color: grey"> Python recipe 576710 by <a href="/recipes/users/1827292/">Michael Palmer</a> (<a href="/recipes/tags/regular_expressions/">regular_expressions</a>, <a href="/recipes/tags/string_substitution/">string_substitution</a>). Revision 5. </p> <p>Not really - all regexes first get combined into a single big disjunction. Then, for each match, the matching sub-regex is determined from a group name and the match object dispatched to a corresponding method, or simply replaced by a string. </p>