Test Method (Regex Object)¶
Tests the regular expression is successfully matched against the specified string. strText Specifies a string to test. Returns True if the regular expression is successfully matched against the specified string, or False if not. Supported in EmEditor Professional Version 15.9 or later.¶
[JavaScript]¶
b = reg.Test( strText );
[VBScript]¶
b = reg.Test( strText )
Parameters¶
Return Values¶
Examples¶
[JavaScript]¶
re = editor.regex;
re.Engine = eeExFindRegexOnigmo;
re.Pattern = "^[A-Z0-9.\%+-]+@[A-Z0-9.-]+\\\.[A-Z]{2,}$";
re.IgnoreCase = true;
b = re.Test( "john@test.com" );
if( b ) alert( "the regular expression matched" );
[VBScript]¶
Set re = editor.regex
re.Engine = eeExFindRegexOnigmo
re.Pattern = "^[A-Z0-9.\%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$"
re.IgnoreCase = True
b = re.Test( "john@test.com" )
If b Then alert( "the regular expression matched" )
Version¶