Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
%RxFind function
Function
The function searches for the first substring that matches the specified regular expression and returns the index where the substring starts.
Declaration
Blok kódu | ||||
---|---|---|---|---|
| ||||
INT %RxFind( TEXT in Text, TEXT in regExp, INT in from, INT out startIndex := 0, INT out endIndex := 0 ) |
Parameters
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). |
Example
The function returns the index, where the substring matching the specified regular expression starts. Optional parameters are startIndex and endIndex. If these parameters are entered, after the function call there are stored starting and ending indexes of the substring that matches the specified regular expression. If the searching is unsuccessfull, or if the from parameter exceeds the total length of input text, the function returns -1. If some of the input parameters is invalid, the function returns undefined value.
Blok kódu | ||||
---|---|---|---|---|
| ||||
%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 |