OBJECT:  Button

object.match(regexp)

This method is used to match a specifed regular expression against a string. To perform a global match include the 'g' (global) flag in the regular expression and to perform a case-insensitive match include the 'i' (ignore case) flag.

The following code uses the match method to search the characters in the myString string for a match with the specified regular expression and displays the reusting string in the browser. Note that the 'i' flag is used to make the search case-insensitive.

Code:
myString = new String("DevGuru.com")
results = myString.match("guru", "i")
document.write(results)

Output:
Guru

Copyright 2000 by Infinite Software Solutions, Inc.
Trademark Information