Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > Regex Object > Methods

EmEditor Macro Reference: Test Method

Scroll Prev Top Next More
EmEditor Home - EmEditor Help - EmEditor Macro Reference - Regex Object

Test Method

Tests the regular expression is successfully matched against the specified string.

[JavaScript]

b  = reg.Test( strText );

[VBScript]

b  = reg.Test( strText )

Parameters

strText

Specifies a string to test.

Return Values

Returns True if the regular expression is successfully matched against the specified string, or False if not.

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

Supported in EmEditor Professional Version 15.9 or later.

Copyright © 2003-2016 by Emurasoft, Inc.