introduction to web programming String Modifiers Finally, pattern matching can be used to modify strings of text. One of the most common methods of modification is substitution. Substitution is performed using the format


Thus, for example, the line:


would change the line

     eric is my name


     selena is my name

The substitution function is modified most commonly with the /i and the /g arguments. The /i argument specifies that matching should be done with case insensitivity and the /g specifies that the match should occur globally for the entire string of text rather than just for the first occurrence.

Thus, the line


would change the line:

     I am Eric, eric I am


     I am selena, selena I am

without the /i, you would get

     I am Eric, selena I am

and without /g but with the /i, you would get

     I am selena, eric I am

There are many, many different kinds of matching operators, anchors, and string modifiers. If you want a more detailed explanation I recommend that you find a good reference source on Regular Expressions. Otherwise, the above discussion should explain how operators and anchors are commonly used in CGI applications.

Previous | Next | Table of Contents