Parsedown::pregReplaceElements( $regexp, $Elements, $text )
Replace occurrences $regexp with $Elements in $text. Return an array of elements representing the replacement.
Description
Source
File: bp-help/vendors/parsedown/Parsedown.php
protected static function pregReplaceElements($regexp, $Elements, $text) { $newElements = array(); while (preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE)) { $offset = $matches[0][1]; $before = substr($text, 0, $offset); $after = substr($text, $offset + strlen($matches[0][0])); $newElements[] = array('text' => $before); foreach ($Elements as $Element) { $newElements[] = $Element; } $text = $after; } $newElements[] = array('text' => $text); return $newElements; }
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.