Hi, everyone.
I would appreciate some assistance here with regular expressions.
I am close, but can't quite put my finger on it.
I have a list of all the states that links to their respective pages:
<li><a id="AL" href="?state=AL">Alabama</a></li>
<li><a id="AK" href="?state=AK">Alaska</a></li>
<!-- etc... //-->
What I need to do is convert those links into the following format:
<li><a id="AL" href="the_problem_states_AL.html">Alabama</a></li>
<li><a id="AK" href="the_problem_states_AK.html">Alaska</a></li>
<!-- etc... //-->
In other words, the files are being saved as HTML files, and shipped off to the client as archives. The STATE Abbreviation, which was part of the query string value, now needs to be incorporated into the link/filename.
Here is what I have so far:
$pattern = '(\<a id=")[A-Z]*(" href="\?state=)[A-Z]*';
$replace = '<a id="\\1" href="the_problem_states_\\2.html';
$newContent = ereg_replace($pattern, $replace, $content);
... but it is not quite working as intended.
It is close, but no cigar as they say. LOL.
Thanks in advance for your help.