Siebel eScript Language Reference > Methods Reference > String Methods >

Search StringVar for Regular Expression Method


The Search StringVar for Regular Expression method searches a string for a regular expression. It returns one of the following:

  • If it finds the regular expression, then it returns the position of this regular expression.
  • If it does not find the regular expression, then it returns negative 1.

You can write code that runs this method in server script or browser script.

This method uses the same argument as the Get Regular Expression From StringVar method. For more information, see Table 38.

Format

stringVar.search(regexp)

Example

The following example uses the Search StringVar for Regular Expression method:

function Test(sValue)
{
//Validate for 5 digit numbers
var sCheck = /^\d{5}$/; //regular expression defining a 5 digit number
if(sValue.search(sCheck)==0)
{
return("Valid");
}
else
{
return("Invalid");
}
}

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