preg_match_all & if

From: Date: Thu, 24 Apr 2003 20:07:56 +0000
Subject: preg_match_all & if
Groups: php.general 
Request: Send a blank email to php-general+get-145193@lists.php.net to get a copy of this message
I have a preg_match_all statement that is currently working when I search through txt files that clients upload... // code preg_match_all("|TEXT TO SEARCH FOR|U",$read,$result); // end_code My question is: is there a way or can you place IF statements inside of preg-match statements? Example: IF preg_match_all("<tr align=\"left\"> \n
                      <td colspan=\"3\"><font face=\"Arial, Verdana, Helvetica, sans-serif\" size=\"2\" color='red'><a href=\"#\" onMouseOver=\"status='Click to read Severe Weather Alert bulletin'; return true;\" onMouseOut=\"status=''\" onClick=\"zone_bull=window.open('cgi-bin/get_ww.cgi?zid=LAZ028', 'zone_bull', 'scrollbars,resizable,width=500, height=400'); zone_bull.focus(); return false;\"><font color=#ff0000>Severe Weather Alert</font></a></font>&nbsp;</td>\n
                      <td colspan=\"2\"><font face=\"Arial, Verdana, Helvetica, sans-serif\" size=\"2\" color='red'><a href=\"#\" onMouseOver=\"status='Click to read National Weather Service zone forecasts'; return true;\" onMouseOut=\"status=''\" onClick=\"zone_bull=window.open('cgi-bin/get_zone.cgi?zid=LAZ028&format=4', 'zone_bull', 'scrollbars,resizable,width=500, height=400'); zone_bull.focus(); return false;\"><font color=#0000FF>Zone Forecast</font></a></font>&nbsp;</td>\n
                    </tr>\n|U", $read, $result);
{ echo "this has a red link"; } ELSEIF preg_match_all("<tr align=\"left\">
                      <td colspan=\"3\"><font face=\"Arial, Verdana, Helvetica, sans-serif\" size=\"2\" color='red'><font face=arial color=#999999>Severe Weather Alerts</font></font>&nbsp;</td>
                      <td colspan=\"2\"><font face=\"Arial, Verdana, Helvetica, sans-serif\" size=\"2\" color='red'><a href=\"#\" onMouseOver=\"status='Click to read National Weather Service zone forecasts'; return true;\" onMouseOut=\"status=''\" onClick=\"zone_bull=window.open('cgi-bin/get_zone.cgi?zid=LAZ028&format=4', 'zone_bull', 'scrollbars,resizable,width=500, height=400'); zone_bull.focus(); return false;\"><font color=#0000FF>Zone Forecast</font></a></font>&nbsp;</td>\n
                    </tr>\n|U", $read, $result);
{ echo "this does not have a link"; } why isnt this working for me? Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: jayfitz@bayou.com ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf

« previous php.general (#145193) next »