Gayathri Srinivasan edited untitled.tex  over 8 years ago

Commit id: a371a0c7e4cf713debd49a6865c0a0e3646c9d72

deletions | additions      

       

\subsubsection{Match():}  Executes a search for a match within a string based on a regular expression. It returns an array of information or null if no match is found.  //match(regexp) \verb|//match(regexp)  //select integers only  var only|  \verb|var  intRegex = /[0-9 -()+]+$/; var |  \verb|var  myNumber = '999';  var '999';|  \verb|var  myInt = myNumber.match(intRegex);  console.log(isInt);  //output: 999  var myNumber.match(intRegex);|  \verb|console.log(isInt);|  \verb|//output: 999|  \verb|var  myString = '999 JS Coders';  var Coders';|  \verb|var  myInt = myString.match(intRegex);  console.log(isInt);  //output: null myString.match(intRegex);|  \verb|console.log(isInt);|  \verb|//output: null|