David C
asked on
Regex validation
Hello, I have a regex string
When I test it on https://regex101.com it looks like it works i.e. selects only the row with {physlasthour} but when I test it on http://regexr.com/ and http://www.regextester.com/ it deletes everything from that point going down
regex.png
<tr id="rpl6".*\{physlasthour6\}.*<\/tr>
that I am validating against the HTML below;<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Production Log</title> <style type="text/css"> * { margin: 0em; padding: 0em; font-family: Arial, Helvetica, sans-serif; } </style></head><body style="background-color: #ffffff; margin: 0px; padding: 0px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #ffffff; font-family: Arial, Helvetica, sans-serif;"> <!--MID CONTAINER STARTS--> <tr> <td> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="lsh" width="10" align="right" valign="top"></td> <td width="780" align="center" valign="top" style="background-color: #FFFFFF; border: solid 1px #d8d8d4; border-width: 0px 1px 0px;"> <!--CONTENT SECTION STARTS--> <table align="center" width="750" height="50" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top" align="left"><a href="Default.aspx"> <img src="logo.jpg" alt="Logo Header" border="0" style="height: 104px; width: 127px" /></a></td> <!--Section Title--> <td width="400" align="center" valign="bottom"> <h1 style="color: #243888; font-size: 40px; margin: 0px; padding: 0px; font-weight: normal; line-height: 28px;">Production Log</h1> </td> </tr> </table> <!--Billing Info Starts--> <table style="background-color: #f3f3f3; border-top: solid 2px #243888;" width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td rowspan="3" width="28"> </td> <td colspan="2" height="20"></td> <td rowspan="3" width="28"> </td> </tr> <tr> <td align="left" valign="bottom"> <!--Billing From--> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="color: #5a5a5a; font-size: 12px; line-height: 18px;"> <tr> <td colspan="2" align="left" valign="top" height="30"><strong style="font-weight: bold; color: #000;">Production Log</strong></td> </tr> <tr> <td width="150">Date</td> <td>: {date} </td> </tr> <tr> <td>Hour</td> <td>: {hour} </td> </tr> <tr> <td>Total SCE (Cumulative)</td> <td>: {totalscethisshift} </td> </tr> <tr> <td>Total Physical (Cumulative)</td> <td>: {totalphysthisshift} </td> </tr> <tr> <td>Total SCE (Last Hour)</td> <td>: {totalscelasthour} </td> </tr> <tr> <td>Total Physical (Last Hour)</td> <td>: {totalphyslasthour} </td> </tr> </table> </td> </tr> <tr> <td colspan="2" height="20"></td> </tr> </table> <!--Billing Info Ends--> <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="25"> </td> </tr> </table> <table width="750" border="0" cellspacing="0" cellpadding="0" style="border: solid 1px #d1d1d1;"> <tr> <td> <!--Invoice Table Starts--> <table border="0" width="100%" cellspacing="0" cellpadding="10" style="border: solid 1px #fff;"> <tr> <th width="40%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal"> </th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: bold; text-decoration: underline;">Last Hour</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: bold; text-decoration: underline;"></th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal"> </th> </tr> <tr> <th width="40%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Product</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Pallets</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Phys</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">SCE</th> </tr> <tr id="rpl0"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 1 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 1 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 84 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 53 </td> </tr> <tr id="rpl1" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 2 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 1 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 70 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 55 </td> </tr> <tr id="rpl2"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 3 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 2 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 140 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 110 </td> </tr> <tr id="rpl3" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 4 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 0 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 70 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 44 </td> </tr> <tr id="rpl4"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 5 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 2 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 232 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 146 </td> </tr> <tr id="rpl5" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> Description 7 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 8 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 128 </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> 403 </td> </tr> <tr id="rpl6"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour6} </td> </tr> <tr id="rpl7" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour7} </td> </tr> <tr id="rpl8"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour8} </td> </tr> <tr id="rpl9" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour9} </td> </tr> <tr id="rpl10"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour10} </td> </tr> <tr id="rpl11" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour11} </td> </tr> <tr id="rpl12"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour12} </td> </tr> <tr id="rpl13" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {descr13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletslasthour13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physlasthour13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scelasthour13} </td> </tr> <tr> <td width="40%"> </td> <td width="10%"> </td> <td width="10%"> </td> <td width="10%"> </td> </tr> <tr style="background-color: #d0d7d8;"> <td> </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; padding-right: 30px; font-weight: bold;">Totals</td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; font-weight: bold;"> {totalphyslasthour} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; font-weight: bold;"> {totalscelasthour} </td> </tr> </table> <!--Invoice Table Ends--> </td> </tr> <tr> <td> <!--Invoice Table Starts--> <table border="0" width="100%" cellspacing="0" cellpadding="10" style="border: solid 1px #fff;"> <tr> <th width="40%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal"> </th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: bold; text-decoration: underline;">This Shift</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: bold; text-decoration: underline;"></th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal"> </th> </tr> <tr> <th width="40%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Product</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Pallets</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">Phys</th> <th width="10%" height="30" align="left" valign="middle" style="background-color: #545454; color: #FFF; font-size: 12px; font-weight: normal">SCE</th> </tr> <tr id="cpl0"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr0} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift0} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift0} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift0} </td> </tr> <tr id="cpl1" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr1} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift1} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift1} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift1} </td> </tr> <tr id="cpl2"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr2} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift2} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift2} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift2} </td> </tr> <tr id="cpl3" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr3} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift3} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift3} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift3} </td> </tr> <tr id="cpl4"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr4} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift4} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift4} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift4} </td> </tr> <tr id="cpl5" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr5} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift5} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift5} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift5} </td> </tr> <tr id="cpl6"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift6} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift6} </td> </tr> <tr id="cpl7" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift7} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift7} </td> </tr> <tr id="cpl8"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift8} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift8} </td> </tr> <tr id="cpl9" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift9} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift9} </td> </tr> <tr id="cpl10"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift10} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift10} </td> </tr> <tr id="cpl11" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift11} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift11} </td> </tr> <tr id="cpl12"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift12} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift12} </td> </tr> <tr id="cpl13" style="background-color: #ececec;"> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {cm_descr13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {palletsthisshift13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {physthisshift13} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px;"> {scethisshift13} </td> </tr> <tr> <td width="40%"> </td> <td width="10%"> </td> <td width="10%"> </td> <td width="10%"> </td> </tr> <tr style="background-color: #d0d7d8;"> <td> </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; padding-right: 30px; font-weight: bold;">Totals</td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; font-weight: bold;"> {totalphysthisshift} </td> <td align="left" style="color: #000; font-weight: normal; font-size: 12px; font-weight: bold;"> {totalscethisshift} </td> </tr> </table> <!--Invoice Table Ends--> </td> </tr> </table> <!--CONTENT SECTION ENDS--> </td> <td class="rsh" width="9" align="left" valign="bottom"></td> </tr> </table> </td> </tr> </table></body></html>
When I test it on https://regex101.com it looks like it works i.e. selects only the row with {physlasthour} but when I test it on http://regexr.com/ and http://www.regextester.com/ it deletes everything from that point going down
regex.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER