RegEx

based on c++ std::regex

the regex flags (string) argument can combine multiple flags when separated by a ; semicolon

search flags;

"any" If more than one match is possible, then any match is an acceptable result
"nnul" Do not match empty sequences
"cont" Only match a sub-sequence that begins at first
"ECMA" Use ECMAScript rules (https://en.cppreference.com/w/cpp/regex/ecmascript)
"psed" Use POSIX sed utility rules https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03
"nunm" Do not copy un-matched strings to the output
"ofir" Only replace the first match

syntax flags

"ECMAScript" default
"basic"
"ext"
"awk"
"grep"
"egrep"
"i" Case insensitive Regular expressions match without regard to case.
"n" No sub – expressions. The match_results structure will not contain sub - expression matches.
"o" Optimize matching. Matching efficiency is preferred over efficiency constructing regex objects.
"c" Character ranges, like "[a-b]", are affected by locale
matchesRegEx
Determines if there is a match between the regular expression and some subsequence in the target character sequence.
replaceRegEx
Uses a regular expression to perform substitution on a sequence of characters
searchRegEx
Determines if there is a match between the regular expression and a subsequence in the target character sequence and returns an array with the results

examples

function TestRegex()
{
    sourceString = "Quick brown fox 123";
    regexWildCard = "[^A-Za-z0-9]";//"a|e|i|o|u";
    replaceString = "-";
    flagsString = "i";  // multiple flags sepparated by ;  ie. "grep;i"
    /* regex flags
        grammar types. use one of the following, "ECMAScript" is default
        "ECMAScript" / "basic" / "ext" / "awk" / "grep" / "egrep"

        "nbol" // The first character in [first,last) will be treated as if it is not at the beginning of a line (i.e. ^ will not match [first,first)
        "neol" // The last character in [first,last) will be treated as if it is not at the end of a line (i.e. $ will not match [last,last)
        "nbow" // "\b" will not match [first,first)
        "neow" // "\b" will not match [last,last)
        "any" // If more than one match is possible, then any match is an acceptable result
        "nnul" // Do not match empty sequences
        "cont" // Only match a sub-sequence that begins at first
        "fval" // --first is a valid iterator position. When set, causes match_not_bol and match_not_bow to be ignored
        "ECMA" // Use ECMAScript rules to construct strings in std::regex_replace (syntax documentation)
        "psed" // Use POSIX sed utility rules in std::regex_replace. (syntax documentation)
        "nunm" // Do not copy un-matched strings to the output in std::regex_replace
        "ofir" // Only replace the first match in std::regex_replace
        
        "i" // i Case insensitive Regular expressions match without regard to case.
        "n" // No sub - expressions	The match_results structure will not contain sub - expression matches.
        "o" // Optimize matching Matching efficiency is preferred over efficiency constructing regex objects.
        "c" // Character ranges, like "[a-b]", are affected by locale.    
    */
    echo("replaceRegEx: " + replaceRegEx(sourceString, regexWildCard, replaceString, flagsString));

    wildcard="o";
    indexInMatch=0; // returns all as array
    echo("searchRegEx: " + objectToString(searchRegEx(sourceString, wildcard, flagsString, indexInMatch)));
	echo("matchesRegEx: " + objectToString(matchesRegEx(sourceString, regexWildCard, flagsString)));
}