src/Core/ContentProcessor.php
public function doRegexpReplace($searchPattern, $replaceWith)
    {
        $this->content = preg_replace_callback(
            $searchPattern,
            function($matches) use ($replaceWith) {
                $indent = isset($matches['indent']) ? $matches['indent'] : '';
                $output = $indent;
                $output .= isset($matches['start']) ? $matches['start'] : '';
                $output .= isset($matches['target']) ? Formatter::indentLines($replaceWith, mb_strlen($indent), true) : '';
                $output .= isset($matches['end']) ? $matches['end'] : '';

                return $output;
            },
            $this->content
        );

        return $this;
    }
public function doRegexpReplace($searchPattern, $replaceWith)
    {
        $this->content = preg_replace_callback(
            $searchPattern,
            function($matches) use ($replaceWith) {
                $indent = isset($matches['indent']) ? $matches['indent'] : '';
                $output = $indent;
                $output .= isset($matches['start']) ? $matches['start'] : '';
                $output .= isset($matches['target']) ? Formatter::indentLines($replaceWith, mb_strlen($indent), true) : '';
                $output .= isset($matches['end']) ? $matches['end'] : '';

                return $output;
            },
            $this->content
        );

        return $this;
    }
public function doRegexpReplace ( $ searchPattern , $ replaceWith ) { $ this -> content = preg_replace_callback ( $ searchPattern , function ( $ matches ) use ( $ replaceWith ) { $ indent = isset ( $ matches [ 'indent' ] ) ? $ matches [ 'indent' ] : '' ; $ output = $ indent ; $ output .= isset ( $ matches [ 'start' ] ) ? $ matches [ 'start' ] : '' ; $ output .= isset ( $ matches [ 'target' ] ) ? Formatter :: indentLines ( $ replaceWith , mb_strlen ( $ indent ) , true ) : '' ; $ output .= isset ( $ matches [ 'end' ] ) ? $ matches [ 'end' ] : '' ; return $ output ; } , $ this -> content ) ; return $ this ; }
Immediately replaces part of data using regular expression

@param $searchPattern string
@param $replaceWith string
@return $this
Immediately replaces part of data using regular expression