regular expressions
| From: | Gerard Samuel | Date: | Sun, 06 Jan 2002 03:16:47 +0000 |
| Subject: | regular expressions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79591@lists.php.net to get a copy of this message | ||
Need some help with this one. Dont know where to begin. I have content in a string and a constant that changes depending on if yourre in the root or in a directory.
The purpose of the constant is to provide dynamic links.
The string will have href links like <a href="index.php">Index</a>
I want to figure out a way to inject my constant value into the href like so
<a href="'._CONSTANT'index.php">Index</a>
I would like the rules to say,
If string contains <href="> and there are <alphanumerical chars> .php place _CONSTANT between <href="> and <alphanumerical chars>
I figure a regular expression, but I have no idea where to start..
Thanks