Finds emojis and replaces them with text enclosed by the delimiter

@param $line
@param $replace
@param $delimiter

@return mixed
345026
protected function emojiToWordReplace($line, $replace, $delimiter)
    {
        foreach ($replace as $key => $value) {
            $line = str_replace($key, $delimiter.$value.$delimiter, $line);
        }

        return $line;
    }
1001714
public static function slugify($str, $replace = array(), $delimiter = '-')
    {
        if (!empty($replace)) {
            $str = str_replace((array)$replace, ' ', $str);
        }

        $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str);
        $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
        $clean = strtolower(trim($clean, '-'));
        $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);

        return $clean;
    }
1293138
public function findReplace(string $find, string $replace)
    {
        $contents = $this->file->getContents();
        $contents = \str_replace($find, $replace, $contents);
        $this->file->setContents($contents);

        return $this;
    }
27298
private static function wildcardToRegex(string $wildcardPattern, string $delimiter = '/'): string
    {
        $converted = preg_quote($wildcardPattern, $delimiter);
        $converted = str_replace('\*', '.*', $converted);

        return $converted;
    }
829805
public static Filter replaceInBuffer(final String regexp, final String replacement) {
        return replaceInBuffer(Pattern.compile(regexp), replacement);
    }
762671
public static function convertSnake($str, $delimiter = '_')
	{
		if (ctype_lower($str)) return $str;

		return strtolower(preg_replace('/(.)(?=[A-Z])/', '$1' . $delimiter, $str));
	}
551015
def replace(cls, replacement_string):
        """"""
        e = cls()

        def _replace_emoji(match):
            val = match.group(1)
            if val in e:
                return e._image_string(match.group(1))
            else:
                return match.group(0)

        return e._pattern.sub(_replace_emoji, replacement_string)
843943
private function escapeOtherCharactersRegex($line)
    {
        // Match numbers ending on ')' or '.' that are at the beginning of the line.
        $regExs = array('/^[0-9]+(?=\)|\.)/');

        foreach ($regExs as $i)
        {
            if (preg_match($i, $line, $match))
            {
                // Matched an escapable character, adding a backslash on
                // the string before the offending character

                $line = substr_replace($line, '\\', strlen($match[0]), 0);
            }
        }

        return $line;
    }
956510
private function replaceWithDelimiter(string $text, string $valid, string $delimiter): string
	{
		$quoted = preg_quote($delimiter);

		// Replace all invalid characters with a single delimiter
		$text = preg_replace(
			'((?:[^'.$valid.']|'.$quoted.')+)us',
			$delimiter,
			$text
		);

		// Remove delimiters from the beginning and the end
		$text = preg_replace('(^(?:'.$quoted.')+|(?:'.$quoted.')+$)us', '', $text);

		return $text;
	}
81201
public static function delimit($string, $delimiter = '_')
    {
        $cacheKey = __FUNCTION__ . $delimiter;

        $result = static::_cache($cacheKey, $string);

        if ($result === false) {
            $result = mb_strtolower(preg_replace('/(?<=\\w)([A-Z])/', $delimiter . '\\1', $string));
            static::_cache($cacheKey, $string, $result);
        }

        return $result;
    }
300936
private function makeReplacements($line, array $replace)
	{
		foreach ($replace as $key => $value)
		{
			$line = str_replace(':' . $key, $value, $line);
		}

		return $line;
	}
515809
function snake( string $delimiter = '_' ) : SplString
    {
        $string = $this->__toString();
        if( !ctype_lower( $string ) ){
            $string = preg_replace( '/\s+/u', '', ucwords( $this->__toString() ) );
            $string = $this->setString( preg_replace( '/(.)(?=[A-Z])/u', '$1'.$delimiter, $string ) );
            $this->setString( $string );
            $this->lower();
        }
        return $this;
    }
90010
public static function toSlug($string, $replace = array(), $delimiter = '-')
    {
        if (!empty($replace)) {
            $string = str_replace((array) $replace, ' ', $string);
        }

        return preg_replace('/[^A-Za-z0-9-]+/', $delimiter, $string);
    }
660437
public static function replace($match, $replace, $org)
    {
        //if $match satisfies regular expression
        if (is::regex($match)) {
            return preg_replace($match, $replace, $org);
        } else {
            return str_replace($match, $replace, $org);
        }
    }
1059825
function (pattern) {
        // Escape everything except ? and *.
        pattern = pattern.replace(regexes.escapeMatcher, regexes.escapeMatchReplacement);
        pattern = pattern.replace(regexes.questionmarkMatcher, regexes.questionmarkReplacment);
        pattern = pattern.replace(regexes.starMatcher, regexes.starReplacement);
        return new RegExp(PREFIX_DELIMITER + pattern + POSTFIX_DELIMITER);
    }
317659
public function pregQuote(string $delimiter = ''): self
    {
        return new self(\preg_quote((string) $this, $delimiter), $this->encoding);
    }
356319
public static function case2camel($string, $delimiter = '_')
    {
        $reg = '/' . $delimiter . '([a-z])/';
        return preg_replace_callback($reg, function ($mathes) use ($delimiter) {
            return trim(strtoupper($mathes[0]), $delimiter);
        }, $string);
    }