Search code examples
pythonregexarraysreplacepreg-replace-callback

Does python's re.sub take an array as the input parameter?


According to http://www.php2python.com/wiki/function.preg-replace-callback/ re.sub is the python equivlant of PHP's preg_replace_callback, but the php version takes an array for the strings to be matched, so you can pass multiple strings, but the re.sub appears to take only a single string.

Is that right or is it my weak knowledge of python?


Solution

  • It only takes a single string http://docs.python.org/library/re.html#re.sub