next up previous contents
Next: anchor Up: Methods Previous: replace   Contents


search

Description
Searches a string for matches to a regular expression or a string.


Syntax

  1. StringObj.search(rgExp)
  2. "String Literal".search(rgExp)
  3. StringObj.search(text)
  4. "String Literal".search(text)


Parameters

rgExp
A Regular Expression object containing the pattern to search for.
text
String. Specifies the text to search for.


Returns

The search method indicates if a match is present or not. If a match is found, the search method returns an integer value that indicates the offset from the beginning of the string where the match occurred. If no match is found, it returns -1.

To get further information, use the match method. The method updates the contents of the RegExp object.




Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.