mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
parent
c88695fb82
commit
8b3b265d87
@ -51,6 +51,7 @@ PREP(dropBackpack);
|
||||
PREP(endRadioTransmission);
|
||||
PREP(eraseCache);
|
||||
PREP(errorMessage);
|
||||
PREP(escapeRegex);
|
||||
PREP(findUnloadPosition);
|
||||
PREP(firedEH);
|
||||
PREP(fixCollision);
|
||||
|
20
addons/common/functions/fnc_escapeRegex.sqf
Normal file
20
addons/common/functions/fnc_escapeRegex.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: LinkIsGrim
|
||||
* Escapes special characters used in regex from a string
|
||||
*
|
||||
* Arguments:
|
||||
* 0: String <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Safe string <STRING>
|
||||
*
|
||||
* Example:
|
||||
* "\Q.*?AK-15.*?\E" call ace_common_fnc_escapeRegex
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
params [["_string", "", [""]]];
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
||||
_string regexReplace ["[.?*+^$[\]\\(){}|-]/gio", "\\$&"]
|
Loading…
x
Reference in New Issue
Block a user