The regular expression small skill in JS - the use of the Test method

xiaoxiao2021-03-06  76

Test method

Returns a boolean value that indicates whether there is a mode in the string of the lookup.

RGEXP.TEST (STR)

parameter

RGEXP

required. Contains regular expressions objects that contain regular expression modes or available flags.

Str

required. To test the string of the lookup.

Description

Test method checks if there is a pattern in the string, if you exist, returns true, otherwise you return false.

The properties of the global regexp object are not modified by the Test method.

Example

The following example exemplifies the usage of the Test method: