Siebel eScript Language Reference > Methods Reference > Regular Expression Methods >

Is Regular Expression in String Method


The Is Regular Expression in String method determines if a string includes a regular expression. It returns one of the following values:

  • If the string includes a regular expression, then it returns the following value:

    True

  • If the string does not include a regular expression, then it returns the following value:

    False

This method uses the same arguments as the Get Regular Expression from String method. For more information, see Table 116.

Format

regexp.test(str)

Usage

The Is Regular Expression in String method is equivalent to regexp.exec(str)!=null.

Usage for this method with T eScript code is the same as usage for the Get Regular Expression from String method. For more information, see Using the Get Regular Expression from String Method with the T eScript Engine.

You can write code that uses the Is Regular Expression in String method with the g global attribute set on the regular expression instance. This functionality uses the lastIndex property in the same way as the Get Regular Expression from String method. For more information, see Usage With Setting the Global Attribute.

Example

The following example includes the Is Regular Expression in String method:

var str = "one two three tio one";
var pat = /t.o/;
rtn = pat.test(str);
// Then rtn == true.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.