Porovnávané verzie
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
%RxFind function
The function searches for the first substring that matches the specified regular expression and returns the index where the substring starts.
Blok kódu | ||||
---|---|---|---|---|
| ||||
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 | outputinput parameter). |
endIndex | Index in text, where the substring matching the specified regular expression ends (optional output parameter). |
The function returns the index, where the substring matching the specified regular expression starts. Optional parameters are startIndex and is endIndex. If these parameters are this parameter is entered, after the function call there are is stored starting and ending indexes index 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 0.
If the parameter regExp is not valid regular expression, 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]+") ;returns the value of 1 %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 |