Method RegEx():test() Foundation

Tests for a match.

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

.T. (true) if the pattern matches, .F. (false) otherwise.

Description

Performs a quick test to determine if the pattern matches anywhere in the subject string. This method is optimized for cases where only a true/false result is needed without further details about the match.

Test pattern

oRegEx := RegEx():create("\d+") 
IF oRegEx:test("abc123xyz") 
? "Contains digits" 
ENDIF 
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.