PHP » PYTHON |
login |
register |
about
|
PYTHON mb_ereg_replace
is this article helpful?
|
Python replacement for PHP's mb_ereg_replace
[
edit
| history
]
import re pattern = re.compile(r'pattern') replacement = re.compile(r'replaced') string = 'Some pattern string' replaced = re.sub(pattern, replacement, string) Or you can use str or unicode directly for pattern and replacement, instead of re.compile(). using raw str: pattern = r'pattern' replacement = r'replaced' using raw unicode: pattern = ur'pattern' replacement = ur'replaced' mb_ereg_replace(PHP 4 >= 4.2.0, PHP 5) mb_ereg_replace — Replace regular expression with multibyte support Description
string mb_ereg_replace
( string $pattern
, string $replacement
, string $string
[, string $option= "msr"
] )
Scans string for matches to pattern , then replaces the matched text with replacement Parameters
Return ValuesThe resultant string on success, or FALSE on error. Notes
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|