int = StrFindRegex(sFull,sFind,sListResults,bIgnoreCase)
This macro function takes a string sFull and searches for occurrences of the string sFind using regular expressions.
The result of this function is the number of occurrences of sFind that are found using regular expressions.
Set bIgnoreCase to true to ignore differences between uppercase and lowercase letters, or to false for case-sensitive matching. Inline options in the regular expression can override this setting.
The details of the found text, if any, are contained in the list sListResults.
If sListResults is not blank, its existing contents are cleared before searching, including when sFull is empty. An empty input string returns zero matches.
•To obtain the strings corresponding to various matches obtained from the present function, see the function getRegexResultString and to obtain the positions corresponding to various matches obtained from the present function, see the function getRegexResultPosition.
•If you only need to know if there is a match (ie. the result of the function is 1 or more), then you can leave the value of sListResults as blank.
•However, if you need the details of the regex match(es), then you need to use List_Create and List_Destroy to create and dispose of the list sListResults.
Below is an example of the use of the macro function StrFindRegex.
// create the list used to hold the regex results
sListRegexResults = List_Create('sListRegexResults')
// look for concatenated string of the form 09*†^§ø-18*†^§ø
sRegex = '([0-9]{2})([*†^§ø]{0,5})-([0-9]{2})([*†^§ø]{0,5})'
nNumRegexFound = StrFindRegex(sCurString, sRegex, sListRegexResults, true)
if nNumRegexFound == 1 // if current entry is a concatenated string
sConcatMin = getRegexResultString(sListRegexResults, 1, 1)
sSymbolsMin = getRegexResultString(sListRegexResults, 1, 2)
sConcatMax = getRegexResultString(sListRegexResults, 1, 3)
sSymbolsMax = getRegexResultString(sListRegexResults, 1, 4)
// process these found values
// ...
endif
// once we are done with the results list, dispose of it
List_Destroy(sListRegexResults)
See also: Pos, PosNth, StrIsContained, StrReplaceRegex.
Topic 188585, last updated on 09-Oct-2026