Regular expressions i :- genius student


  • A regular expressions are patterns.
  • That is used to match character combinations in string.
  • That can also used to search-and-replace functions on text.
  • i called as a modifier .Which is used to perform case-insensitive matching.
  • Code:-

    <!DOCTYPE html>
    <html>

    <head>
     <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>

    <body>
     <h1>Regular Expression i</h1>

     <button onclick="fun_regexgno();">No i Regular Expression</button>

     <button onclick="fun_regexgi()">i Regular Expression</button>

     <script>
      var str = "WELCOME";

      //i=> case-insensitive
      function fun_regexgi()
      {
       alert(str.replace(/w/i, "#"));
      }

      //without using 'i'
      function fun_regexgno()
      {
       alert(str.replace(/w/, "#"));

      }
     </script>

    </body>

    </html>
    Regular expressions i :- genius student Regular expressions i :- genius student Reviewed by Network security on October 27, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.