I'm trying to improve some code and was wondering is there some parameter/command in which I don't always have to escape special literals using _StringRegExpMetaCharacters? As it really increases the speed since I'm replacing entire functions. StringReplace is just even slower.
Local $sData = FileRead(@ScriptFullPath), $sReplace = '-\*--*\-' ; $sData = StringRegExpReplace($sData, '\Q(\E', $sReplace) ; This doesn't work correctly. ; Replace ( with *--* $sReplace = _StringRegExpMetaCharacters($sReplace) $sData = StringRegExpReplace($sData, '\Q(\E', _StringRegExpMetaCharacters($sReplace)) ConsoleWrite('Replacement String: ' & $sReplace & @CRLF & @CRLF) ConsoleWrite($sData & @CRLF) Func _StringRegExpMetaCharacters($sString) ; By guinness 2013. Return StringRegExpReplace($sString, '([].|*?+(){}^$\\[])', '\\\1') EndFunc ;==>_StringRegExpMetaCharacters