Replaces all occurrences of $pattern in $str by $replacement. An alias
for mb_ereg_replace(). Note that the 'i' option with multibyte patterns
in mb_ereg_replace() requires PHP 5.6+ for correct results. This is due
to a lack of support in the bundled version of Oniguruma in PHP < 5.6,
and current versions of HHVM (3.8 and below).
public regexReplace ( string $pattern, string $replacement, string $options = 'msr' ) : |
||
$pattern | string | The regular expression pattern |
$replacement | string | The string to replace with |
$options | string | Matching conditions to be used |
return | Object with the resulting $str after the replacements |
/** * Guesses possible raw data keys from a constructor parameter name. * * @param \ReflectionParameter $parameter The parameter to guess keys for * * @return array */ private function getPossibleParameterKeys(\ReflectionParameter $parameter) { $parameterString = new Stringy($parameter->getName()); return array((string) $parameterString->underscored(), (string) $parameterString->regexReplace('([a-z]+)([0-9]+)', '\\1_\\2'), $parameter->getName()); }