The function searches for the first substring that matches the specified regular expression and returns the index where the substring starts.
INT %RxFind( TEXT in Text, TEXT in regExp, INT in from, INT out startIndex := 0, INT out endIndex := 0 ) |
text | Text, which is to be searched. |
regExp | Regular expression that will be searched in the input parameter text. |
from | Index, from where the input parameter text will be searched. |
startIndex | Index in text, where the substring matching the specified regular expression starts (optional output parameter). |
endIndex | Index in text, where the substring matching the specified regular expression ends (optional output parameter). |
%RxFind("text some text", "[a-z]+", 1) ;returns the value of 1 %RxFind("123text some text", "[a-z]+", 1) ;returns the value of 4 %RxFind("text some text", "[a-z]+", 5, _first, _last) ;returns the value of 6, _first = 6, _last = 11 %RxFind("text some text", "[a-z]+", 20, _first, _last) ;returns the value of -1, _first = -1, _last = -1 %RxFind("text some text", "", 20, _first, _last) ;returns undefined value (length of regexp is 0), _first = 0, _last = 0 |