JavaScript Reference/Javascript Methods/match

Материал из Web эксперт
Перейти к: навигация, поиск

"match()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="var myS = new String("Sample String");

                alert(myS.match(/sam/i));">Match a string</button>

</body> </html>


     </source>
   
  


"match()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |String | +----------------+--------------------------------------------------------------+

     </source>
   
  


"match()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Searches the String using a regular expression.

Syntax:

stringName.match(param1) Parameters:

   param1   Required; the regular expression.
   
     
     </source>