Find: Two commands, one with array return, and one with boolean:
string regexFind [regex, startFrom, returnAll];
string: STRING: the string to search in
regex: STRING: regular expression
startFrom: NUMBER: the start index
returnAll: BOOL: (optional) return all results
Returns: ARRAY: Array of string-number pairs in format: [[match1, position1], [match2, position2] , ...] (if returnAll is false, only the first match is returned). If no match is found or there is an error, an empty array is returned.
string regexMatch regex
string: STRING: the string to search in
regex: STRING: regular expression
Returns: BOOL: whether a match was found
Replace: replace all found matches:
string regexReplace [regex, replace]
string: STRING: the string to search in
regex: STRING: regular expression
replace: STRING: regular expression
Returns: STRING: the string after replacing all found matches (or original string in case of error)
For single replace, one can use find and replace together:
_text = "Hello world!"; _firstMatch = _text regexFind ["\w+", 0]; _firstMatch params ["_match", "_pos"]; _newText = (_text select [0, _pos]) + (_match regexReplace ["\w+", "blabla"]) + (_text select [_pos + count _match]);