Skip to main content

Posts

Showing posts from November, 2008

Custom Tags Parsing Using Regular Expressions

In the last post, we had created a simple custom tag parsing script using PHP string functions. In this post, we are going to continue our discussion on custom tag parsing but rather using Regular Expressions. Here we will see how regular expressions can used to parse strings, we will also see where to and where not to use Regular Expressions. Before continuing, I expect that you have a working knowledge of Regular Expressions if not please first check out this websites . Let us first create the previous custom tag parsing script using expressions: <form name="form1" method="get" action="">   <p>     <!-- textarea should display previously wriiten text -->     <textarea name="content" cols="35" rows="12" id="content"> <?  if (isset( $_GET [ 'content' ])) echo  $_GET [ 'content' ];  ?> </textarea>   </p>   <p>     <input name