Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

Verzia 1 Ďalej »

%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
INT %RxFind(
   TEXT in Text, 
   TEXT in regExp,
   INT	in from,
   INT	out startIndex := 0,
   INT	out endIndex := 0
 )
Parameters
textText, which is to be searched.
regExpRegular expression that will be searched in the input parameter text.
fromIndex, from where the input parameter text will be searched.
startIndexIndex in text, where the substring matching the specified regular expression starts (optional output parameter).
endIndexIndex 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.
 
%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
  • Žiadne štítky