Page 317 - Computer Software Application TP - Volume 1
P. 317

COMPUTER SOFTWARE APPLICATION - CITS




           X  Matching word boundaries

              1  Open the text editor
              2  Write the following codes
                             <html >
                    <head>

                         <title> Matching word boundaries </title>
                    </head>
                    <body>
                           <?php
                         $string = “The quick brown fox jumps over the lazy dog.”;
                         $pattern = “/\bfox\b/”;  // Matches “fox” as a whole word

                         if (preg_match($pattern, $string))
                         {
                                 echo “The word ‘fox’ is present as a whole word.”;
                         }

                    ?>
                    </body>
                    </html>
              3  Save the program in C:\Apache24\htdocs in a folder with .php extension
              4  Run the Apache services from windows services

              5  Open the browser and type the following address
                 http://localhost/foldername/
              6  Click the php file to run and verify the output















           TASK 2 : Using modifiers

           I  i (case-insensitive) modifier
              1  Open the text editor
              2  Write the following codes
                             <html >

                    <head>
                         <title> i (case-insensitive) modifier </title>
                    </head>
                    <body>



                                                           302

                               CITS : IT & ITES - Computer Software Application - Exercise 58
   312   313   314   315   316   317   318   319   320   321   322