Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Methods Reference > Regular Expression Methods > Get Regular Expression from String MethodThe Get Regular Expression from String method searches the string that you specify in the str argument for a regular expression. It returns one of the following depending on if it finds this regular expression:
FormatTable 116 describes the arguments for the Get Regular Expression from String method.
Usage Without Setting the Global AttributeAssume you configure Siebel CRM to run the Get Regular Expression from String method, you do not set the g global attribute on the regular expression instance, and the method finds a match. In this situation, the array elements that it returns include the following information:
The returned array includes the following properties:
Usage With Setting the Global AttributeAssume you configure Siebel CRM to run the Get Regular Expression from String method but you do set the g global attribute on the regular expression instance. In this situation, this method returns the same result as if the global attribute is not set but the behavior is more complex, which allows more operations. It does the following work:
The this.lastIndex property possesses read and write capabilities. To find all matches of a pattern, you can configure this method to set the this.lastIndex property to the start position of the previous match that it found plus 1. This configuration causes this method to loop through a string. When it does not find a match, it resets the this.lastIndex property to 0. Using the Get Regular Expression from String Method with the T eScript EngineIf you use code that you create with the T eScript engine, and if the Get Regular Expression from String method finds a match, then it sets the appropriate static properties of the regular expression object. For example, it sets the following properties: This configuration provides more information about the matches. Using the Get Regular Expression from String Method and the Get Regular Expression from StringVar MethodThe behavior of the Get Regular Expression from String method and the Get Regular Expression from StringVar method varies depending on if you set the global attribute on the regular expression:
For more information, see Get Character From String Method. Example 1The following example calls the Get Regular Expression from String method from a regular expression whose global attribute is not set: function fn () This example provides the following output: return[0] = etter \\First text that contains primary pattern ...er (any three \\characters followed by "er") Example 2The following example calls the Get Regular Expression from String method from a regular expression whose global attribute is set. This method returns all matches that exist of the primary pattern in a string of the regular expression, including matches that overlap: function fn () This example provides the following output: Text = ttt Pos = 0 End = 2 Related Topics |
Siebel eScript Language Reference | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |