Method RegEx():find() Foundation

Finds the first match position.

Syntax
:find( <cSubject>, [<nStartPos>] ) --> nStartPosition
Parameters
<cSubject>
The subject string to search.
<nStartPos>
An optional starting position for the search. This defaults to 1.
Return

The starting position of the match or 0 if no match is found.

Description

Locates the first occurrence of the pattern in the subject string and returns its starting position. This method is useful when only the position is needed without the matched text.

Find

oRegEx := RegEx():create("ERROR") 
nPos := oRegEx:find("System ERROR at line 42") 
? nPos  // 8 
oRegEx:destroy() 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.