# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^(?:(?:(?!table).)*table){19}(.+?(?=table))"
test_str = ("<HTML><HEAD><TITLE>Purchase order: PSD00592</TITLE><link id=\"cssref\" rel=\"stylesheet\" type=\"text/css\" href=\"IE5BIRCHST08.css\">\n"
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"
"</HEAD><BODY><TABLE width=98% border=\"1\" align=center><tr><td><form name='doclife'><input type='hidden' name='doccycle' value=108891162271488190605350.1266cosbor|536|328></form><TABLE width=100% cellSpacing=0 <tr><td colspan=\"2\" align=\"center\"><font size=4><b>PURCHASE ORDER</b></td></tr><tr><td colspan=\"2\" align=\"center\"><font size=3><b>Pendry San Diego </b></td></tr><tr><td colspan=\"2\" align=\"center\"><font size=\"2\"><b>RGC Gaslamp LLC</b></td></tr><tr><td colspan=\"2\" align=\"center\"><font size=\"2\"><i>Montage Hotels & Resorts Marketplace</i></td></tr><tr style=\"height=.1\"><td colspan=\"2\" align=\"center\"><HR></td></tr><tr><td align=\"left\"><font size=\"2\"><b>PO NUMBER : </b>PSD00592</td><TD align=\"left\"><font size=\"2\"><b>Status: </b>Fax/email/csv accepted</TD></tr><tr><td align=\"left\"><font size=2 ><b>Delivery date : </b>02/27/2017</font></td><TD align=\"left\"><font size=\"2\"><b>PO Submit Date: </b>02/27/2017 02:17:00</TD></tr><tr><td><font size=\"2\"><b>Customer Account #: </b></font></td></tr><tr><td> <font size=\"2\"><b>PO Type: </b>Standard</font></td></tr><tr><td align=\"left\"><font size=\"2\"><b>Purchase type : </b>Food</td><TD align=\"left\"><font size=\"2\"></TD></tr> <tr style=\"height=.1\"><td colspan=2><hr></td></tr> <tr> <td align=\"left\" valign=\"top\"><font size=\"2\"><b>Supplier:</b> SPECIALTY PRODUCE(On the Fly)</font> <table> <tr><td colspan=2><font size=\"2\">1929 Hancock st</td></tr> <tr><td colspan=2><font size=\"2\">Suite 150</td></tr> <tr><td colspan=2><font size=\"2\">san diego, CA, 92110</td></tr> <tr><td colspan=2><font size=\"2\"><b>Attn:</b> Matt Preston </td></tr> <tr><td><font size=\"2\"><b>Title:</b> </td><td><font size=\"2\"></td></tr> <tr><td><font size=\"2\"><b>Phone:</b> </td><td><font size=\"2\">6192470394</td></tr> <tr><td><font size=\"2\"><b>Fax:</b> </td><td><font size=\"2\"></td></tr> <tr><td><font size=\"2\"><b>Email:</b> </td><td ><font size=\"2\">ordersnext@specialtyproduce.com</td></tr> <tr><td><font size=\"2\"><b>DBA:</b> </td><td><font size=\"2\"></td></tr> </table> </td> <td align=\"left\" valign=\"top\"><b><font size=\"2\">Bill To:</b> Pendry San Diego</font> <table> <tr><td><font size=\"2\">P.O. Box 52031</td></tr> <tr><td><font size=\"2\">Phoenix, AZ, 85072, US</td></tr> <tr><td><font size=\"2\"><b>Attn: </b>Montage Hotels & Resorts</td></tr> </table>\n"
"<table><tr><td> </td></tr></table>\n"
" <font size=\"2\"><b>Ship To: </b> Pendry San Diego</font> <table > <tr><td><font size=\"2\">550 J Street</td></tr> <tr><td><font size=\"2\">San Diego, CA, 92101, US</b></td></tr> <tr><td><font size=\"2\"><b>Attn:</b> Christopher Osborne</b></td></tr> </table> </td> <tr style=\"height=.1\"><td colspan=2><hr></td></tr> <tr> <td align=\"left\"><font size=\"2\"><b>Sent From: </b>Pendry San Diego</font> <table > <tr><td><font size=\"2\"><b>Name: </b></td><td><font size=\"2\">Christopher Osborne</td></tr> <tr><td><font size=\"2\"><b>Phone: </b></td><td><font size=\"2\">(949) 715-5000</td></tr> <tr><td><font size=\"2\"><b>Fax: </b></td><td><font size=\"2\"></td></tr> <tr><td><font size=\"2\"><b>Email: </b></td><td ><font size=\"2\">cosborne@pendryhotels.com</td></tr> <tr><td><font size=\"2\"><b>Cost Center: </b></td><td><font size=\"2\"></td></tr> </table> </td> <td align=\"left\" valign=\"top\"><font size=\"2\"><b>Terms: </b> <table > <tr><td colspan=2><font size=\"2\"><b>Subject: </b></td><td><font size=\"2\">Provisional order</td></tr> <tr><td colspan=2><font size=\"2\"><b>Partial Order Accepted: </b></td><td><font size=\"2\">No</td></tr> <tr><td colspan=2><font size=\"2\"><b>Ship via: </b></td><td width = 140><font size=\"2\">Best Way</td></tr> <tr><td colspan=2><font size=\"2\"><b>Payment Terms: </b></td><td><font size=\"2\">Net 30 Days (description)</td></tr> <tr id=dept><td colspan=2><font size=\"2\"><b>Department: </b></td><td><font size=\"2\">50-205-Provisional</td></tr> <tr><td colspan=2><font size=\"2\"><b>Payment method: </b></td><td><font size=\"2\">Purchase order</td></tr> </table> </td> </tr> <tr style=\"height=.1\"><td colspan=2><hr></td></tr> <table><tr><td> <b><font size=\"2\"><b>Notes and Attachments :</b> </td><td id='hide' style=\"visibility:hidden;position:absolute\"><div name='Button' ><font color=\"#003399\">   Show Line Notes<input type = checkbox name = \"showInlineNotes\" value=\"ON\" onclick=\"ShowLineNotes(this,0)\"></font></div></td></tr></table> <table width=100%> <tr><tr><td><font size=2><b> Header Notes :</b></font></td></tr><tr><td><font size=2>No Notes</font></td></tr> <td><font size=2>This Purchase Order has <b>0</b> Attachments</font></td> </tr> </table> </td> </tr> <tr> <td colspan=2> <table width=100% align=center cellspacing=\"0\"> <tr><td ><font size=\"2\"><b>#</b></td><td ><font size=\"2\"><b>Item SKU</b></td><td ><font size=\"2\"><b>Product Desc.</b></td><td align=right><font size=\"2\"><b>Qty</b></td><td align=center><font size=\"2\"><b>UOM</b></td><td align=right><font size=\"2\"><b>Price</b></td><td align=right><font size=\"2\"><b>Extension</b></td></tr> <tr><td VALIGN =baseline><font size=\"2\">1</td><td VALIGN =baseline width = 100 style=font-size:10pt>022 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Bananas</td><td VALIGN =baseline align=right style=font-size:10pt>0.50</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$24.8000</td><td VALIGN =baseline align=right><font size=\"2\">$12.40</td> <tr><td VALIGN =baseline><font size=\"2\">2</td><td VALIGN =baseline width = 100 style=font-size:10pt>056 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Berries Strawberry</td><td VALIGN =baseline align=right style=font-size:10pt>0.50</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$24.2000</td><td VALIGN =baseline align=right><font size=\"2\">$12.10</td> <tr><td VALIGN =baseline><font size=\"2\">3</td><td VALIGN =baseline width = 100 style=font-size:10pt>085 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Cheese Burrata DiStefano</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$28.5000</td><td VALIGN =baseline align=right><font size=\"2\">$28.50</td> <tr><td VALIGN =baseline><font size=\"2\">4</td><td VALIGN =baseline width = 100 style=font-size:10pt>082 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Cheese Pecorino Toscano DOP Aged 6 mo.</td><td VALIGN =baseline align=right style=font-size:10pt>6.00</td><td VALIGN =baseline align=center style=font-size:10pt>LB</td><td VALIGN =baseline align=right style=font-size:10pt>$9.5800</td><td VALIGN =baseline align=right><font size=\"2\">$57.48</td> <tr><td VALIGN =baseline><font size=\"2\">5</td><td VALIGN =baseline width = 100 style=font-size:10pt>078 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Dairy Yogurt Plain Organic Clover</td><td VALIGN =baseline align=right style=font-size:10pt>3.00</td><td VALIGN =baseline align=center style=font-size:10pt>TUB</td><td VALIGN =baseline align=right style=font-size:10pt>$5.4000</td><td VALIGN =baseline align=right><font size=\"2\">$16.20</td> <tr><td VALIGN =baseline><font size=\"2\">6</td><td VALIGN =baseline width = 100 style=font-size:10pt>087 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>FM Herbs Sorrel Wood - Coleman Family Farm</td><td VALIGN =baseline align=right style=font-size:10pt>2.00</td><td VALIGN =baseline align=center style=font-size:10pt>BU</td><td VALIGN =baseline align=right style=font-size:10pt>$3.7500</td><td VALIGN =baseline align=right><font size=\"2\">$7.50</td> <tr><td VALIGN =baseline><font size=\"2\">7</td><td VALIGN =baseline width = 100 style=font-size:10pt>036 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>FM Passionfruit - Koral's Tropical Fruit Farm</td><td VALIGN =baseline align=right style=font-size:10pt>3.00</td><td VALIGN =baseline align=center style=font-size:10pt>LB</td><td VALIGN =baseline align=right style=font-size:10pt>$8.5000</td><td VALIGN =baseline align=right><font size=\"2\">$25.50</td> <tr><td VALIGN =baseline><font size=\"2\">8</td><td VALIGN =baseline width = 100 style=font-size:10pt>092 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>FM Radish Long Scarlet - Valdivia Farm</td><td VALIGN =baseline align=right style=font-size:10pt>5.00</td><td VALIGN =baseline align=center style=font-size:10pt>BU</td><td VALIGN =baseline align=right style=font-size:10pt>$2.5000</td><td VALIGN =baseline align=right><font size=\"2\">$12.50</td> <tr><td VALIGN =baseline><font size=\"2\">9</td><td VALIGN =baseline width = 100 style=font-size:10pt>093 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>FM Radish Watermelon - Black Sheep Produce</td><td VALIGN =baseline align=right style=font-size:10pt>5.00</td><td VALIGN =baseline align=center style=font-size:10pt>BU</td><td VALIGN =baseline align=right style=font-size:10pt>$2.2500</td><td VALIGN =baseline align=right><font size=\"2\">$11.25</td> <tr><td VALIGN =baseline><font size=\"2\">10</td><td VALIGN =baseline width = 100 style=font-size:10pt>003 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Fresh Micro Radish Mix</td><td VALIGN =baseline align=right style=font-size:10pt>2.00</td><td VALIGN =baseline align=center style=font-size:10pt>CRT</td><td VALIGN =baseline align=right style=font-size:10pt>$11.9500</td><td VALIGN =baseline align=right><font size=\"2\">$23.90</td> <tr><td VALIGN =baseline><font size=\"2\">11</td><td VALIGN =baseline width = 100 style=font-size:10pt>007 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Fresh-Clams Venus</td><td VALIGN =baseline align=right style=font-size:10pt>5.00</td><td VALIGN =baseline align=center style=font-size:10pt>LB</td><td VALIGN =baseline align=right style=font-size:10pt>$3.9500</td><td VALIGN =baseline align=right><font size=\"2\">$19.75</td> <tr><td VALIGN =baseline><font size=\"2\">12</td><td VALIGN =baseline width = 100 style=font-size:10pt>017 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Herbs Parsley Reg bunch</td><td VALIGN =baseline align=right style=font-size:10pt>12.00</td><td VALIGN =baseline align=center style=font-size:10pt>BU</td><td VALIGN =baseline align=right style=font-size:10pt>$0.2500</td><td VALIGN =baseline align=right><font size=\"2\">$3.00</td> <tr><td VALIGN =baseline><font size=\"2\">13</td><td VALIGN =baseline width = 100 style=font-size:10pt>069 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Lett Boston Hydroponic</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$27.8500</td><td VALIGN =baseline align=right><font size=\"2\">$27.85</td> <tr><td VALIGN =baseline><font size=\"2\">14</td><td VALIGN =baseline width = 100 style=font-size:10pt>094 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Local- Root Turnips Pink - JF Organic Farms</td><td VALIGN =baseline align=right style=font-size:10pt>8.00</td><td VALIGN =baseline align=center style=font-size:10pt>BU</td><td VALIGN =baseline align=right style=font-size:10pt>$2.2500</td><td VALIGN =baseline align=right><font size=\"2\">$18.00</td> <tr><td VALIGN =baseline><font size=\"2\">15</td><td VALIGN =baseline width = 100 style=font-size:10pt>079 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Local- Wood Fig - Murray Family Farm</td><td VALIGN =baseline align=right style=font-size:10pt>10.00</td><td VALIGN =baseline align=center style=font-size:10pt>LB</td><td VALIGN =baseline align=right style=font-size:10pt>$1.1700</td><td VALIGN =baseline align=right><font size=\"2\">$11.70</td> <tr><td VALIGN =baseline><font size=\"2\">16</td><td VALIGN =baseline width = 100 style=font-size:10pt>057 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Melons Cantelope</td><td VALIGN =baseline align=right style=font-size:10pt>3.00</td><td VALIGN =baseline align=center style=font-size:10pt>EA</td><td VALIGN =baseline align=right style=font-size:10pt>$3.1000</td><td VALIGN =baseline align=right><font size=\"2\">$9.30</td> <tr><td VALIGN =baseline><font size=\"2\">17</td><td VALIGN =baseline width = 100 style=font-size:10pt>020 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Mush Hon Shimeji (Brown Beech)</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$42.5000</td><td VALIGN =baseline align=right><font size=\"2\">$42.50</td> <tr><td VALIGN =baseline><font size=\"2\">18</td><td VALIGN =baseline width = 100 style=font-size:10pt>027 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Mush Maitake USA</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$42.5000</td><td VALIGN =baseline align=right><font size=\"2\">$42.50</td> <tr><td VALIGN =baseline><font size=\"2\">19</td><td VALIGN =baseline width = 100 style=font-size:10pt>059 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Pineapple Large</td><td VALIGN =baseline align=right style=font-size:10pt>0.50</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$16.4500</td><td VALIGN =baseline align=right><font size=\"2\">$8.23</td> <tr><td VALIGN =baseline><font size=\"2\">20</td><td VALIGN =baseline width = 100 style=font-size:10pt>013 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Tom Chry Heirlm Mix Mini</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$25.7500</td><td VALIGN =baseline align=right><font size=\"2\">$25.75</td> <tr><td VALIGN =baseline><font size=\"2\">21</td><td VALIGN =baseline width = 100 style=font-size:10pt>117 *</td><td VALIGN =baseline width = 200 style=font-size:10pt>Tomatillos</td><td VALIGN =baseline align=right style=font-size:10pt>1.00</td><td VALIGN =baseline align=center style=font-size:10pt>CS</td><td VALIGN =baseline align=right style=font-size:10pt>$7.5000</td><td VALIGN =baseline align=right><font size=\"2\">$7.50</td> <tr><td colspan=12 align=center><font size=\"2\"><hr></td></tr> <tr><td colspan=4><b><font size=\"2\">* - Non catalog item</fond></td></tr> <tr><td colspan=4 align=right><b><font size=\"2\">Sub Total:</b></td><td></td><td></td><td align=right><font size=\"2\">$423.41</td></tr> <tr><td colspan=4 align=right><b><font size=\"2\">Freight:</b></td><td></td><td></td><td align=right><font size=\"2\">$0.00</td></tr> <tr><td colspan=4 align=right><b><font size=\"2\">Tax Amount:</b></td><td></td><td></td><td align=right><font size=\"2\">$0.00</td></tr> <tr><td colspan=4 align=right><b><font size=\"2\">Less Discount:</b></td><td></td><td></td><td align=right><font size=\"2\">$0.00</td></tr> <tr><td colspan=4 align=right><b><font size=\"2\">Total amount due:</b></td><td></td><td></td><td align=right><font size=\"2\">$423.41</td></tr> </table> <font size=\"1\"> </font> </td> </tr></td></tr></table>\n"
"</BODY></HTML>")
matches = re.finditer(regex, test_str, re.DOTALL | re.IGNORECASE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html