# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^[-+.]?\d(.*[\da-zA-Z])?$"
test_str = ("Date : 12/21/2021 BILL OF LADING Page 1\n"
"SHIP FROM Bill of Lading Number : 0233052667\n"
"Name : KUBOTA TRACTOR CORPORATION\n"
"Address : 31700 W 207TH ST\n"
"City/State/Zip : EDGERTON KS 66021\n"
"SID# FOB :\n"
"SHIP TO Carrier Name : XPO Freight\n"
"Name : FLORIDA COAST EQUIPMENT, LLC Location# : Trailer Number :\n"
"Address : 2114 SOUTH ORANGE BLOSSOM Seal Number(s) :\n"
"SCAC : CNWY\n"
"City/StatelZip : APOPKA FL,32703\n"
"CID# FOB : Pro number : 540409004\n"
"THIRD PARTY FREIGHT CHARGES BILL TO\n"
"Name : Kubota Tractor\n"
"Address : c/o Simplified Logistics, LLC\n"
"PO BOX 40088 Freight Charge Terms : (freight charges are prepaid\n"
"City/State/Zip : Bay Village, OH, 44140 unless marked otherwise).\n"
"Ref# : 0233052667 Prepaid X Collect 3rd Party\n"
"Master Bill Of Lading with attached\n"
"(check box) underlying Bills of Lading\n"
"SPECIAL INSTRUCTIONS :\n"
"CUSTOMER ORDER INFORMATION\n"
"CUSTOMER ORDER NUMBER #PKGS WEIGHT PALLET/SLIP ADDITIONAL SHIPPER INFO\n"
"(CIRCLE ONE)\n"
"12105 1 164.000 Y N :\n"
"ANTAI Hours piek-up\n"
"TEC : 1 2017\n"
"GRAND TOTAL 1 164.000\n"
"CARRIER INFORMATION\n"
"HANDLING UNIT. PACKAGE COMMODITY DESCRIPTION LTLONLY\n"
"brattention Commodities in requiring handling special or stowing or adottional must be marked care and\n"
"QTY TYPE QTY TYPE WEIGHT H.M See Backaged Section as to 2(0) ensure Of NMFC safe Item transportation 360 with ordinary care.. NMFC# CLASS\n"
"X)\n"
".1 PLT 164.000 Tractor Parts : 50\n"
": 164.000 ЕВ : GRAND TOTAL\n"
"Where the rate is dependent on value shippers are required to state specifically in writing the agreed or COD Amount :\n"
"declared \"The agreed value or of declared the property value of as follows the property : is specifically stated by the shipper to be not exceeding\n"
"Fee Terms Collect : $ Prepaid :\n"
"per Customer Check Acceptable :\n"
"Note : Liabilty Limitation for loss or damage in this shipment may be applicable. See 49 U.S.C.-14706(0)1/A)and(B).\n"
"RECEIVED, subject to individually determined rates or contracts that have been agreed upon in writing The carrier shall not make delivery of this shipment without\n"
"between the carrier and shipper if applicable otherwise to the rates, classification and rules that have been payment of freight and all other lawful charges\n"
"she/he established is familiar by the with carrier all the and terms are available and conditions to the shipper, of the NMFC on request. Uniform The Straight shipper Bill hereby Of Lading, certifies including that _Shipper\n"
"those on the back thereof, and the said terms and.conditions are hereby agreed to by the shipper and Signature\n"
"accepted for him/herself and his/her assigns\n"
"This is to certify that the above named material Trailer Loaded Freight Counted CARRIER SIGNATURE/PICKUP DATE\n"
"are properly classified, packaged, marked and Carrier acknowledge receipt of packages and required\n"
"transportation labeled and are according in proper to condition the applicable for By Shipper By Shipper placards. Carrier certifies emergency response\n"
"regulations of the DOT. By Driver By Driver/pallets information DOT emergency was made response available guidebook and/or and carrier or equivalent has the\n"
"said to contain documentation in the vehicle : Property described above is\n"
"SHIPPER SIGNATURE/DATE received in good order, except as noted.\n"
"中 By Driver/pieces\n"
"52\n"
"Date : 12/16/21 BILL OF LADING Page : 1 of 1\n"
"Valve Bill of Lading Number : 0002935540\n"
"Naine : Hydraulic\n"
"Phone :\n"
"Address 1 : 373 Meuse Argonne\n"
"Address 2 :\n"
"USSID# City/St/ZIP/Country : HICKSVILLE, OH, 43526,\n"
": 711379002 FOB : CARRIER NAME : XPO Logistics\n"
"Trailer Number;\n"
"Name : 094-ROANOKE MANUFACTURING Seal Number : (s) :\n"
"Phone :\n"
"Address 1 : 325 S CENTER DR SCAC : XPOL\n"
"Address2 : DOOR 94 Pro Number : 521337482\n"
"City/St/Zip/Country : DALEVILLEVA, 24083, US\n"
"CID # : 880068-12675 FOB;\n"
"Name : ALTEC C/O CHRLTL\n"
"Address1 : 14800. CHARLSON ROAD EDEN\n"
"Freight Charge Terms : (freight charges are prepaid\n"
"Address2 :\n"
"City/St/Zip/Country : EDEN PRAIRIE, MN, 55347, US unless markedotherwise)\n"
"SPECIAL INSTRUCTIONS : Prepaid : Collect Third Party X\n"
"Master Bill of Lading : with attached\n"
"underlying Bills of Lading\n"
"CUSTOMER ORDER NUMBER #PKGS VOLUME WEIGHT PALLET/SLIP ADDITIONAL. SHIPMENT INFO\n"
"(circle one)\n"
"880068-12675 1 0.0 162 : 00 Y (N)\n"
"GRAND TOTAL 0.0 CF 162.00 LB\n"
"HANDLING PACKAGE H.M. COMMODITY DESCRIPTION LTL ONLY\n"
"UNIT {X) Commodities roquiring special or additional care or attention\n"
"in : llandling or stowing must be so marked and packaged\n"
"QTY TYPEQTY TYPE VOLUME WEIGHT so as to ensure safer transportation with ordinary care NMFC# CLASS\n"
"Sce Scction 21e) or NMFC Item 3:00\n"
"1 #3 1/2 PALLET 0.0 162.00 PARTS, EXCEPT VALVE BODIES, OF VALVES\n"
"Driver's signature acknowledges receipt of\n"
"freight only. Received shipment is subject\n"
"to terms of a written contract, if any, otherwise subject to 521-337482\n"
"the terms, conditions and limitations of liability set forth in\n"
"XPO Logistics Freight, Inc. rules tariff (see www.xpo.com) XPOLogistics\n"
"HOS 162.00 L GRAND : TOTAL\n"
"Wiere llie rate is depended on value, Slippers are required lo stari specifically in writing the COD Amount\n"
"agreed or declared value of the properly as follows :\n"
"The agreed declared value of the property is specifically stated by the shipper to be not excecding Fee Terms Collect Prepaid\n"
"per Customer check acceptable\n"
"NOTE Libillty Limitation for loss or damage in this shipment may be applicable. See 49 U.S.C 74706(c)(1)(A) and (B).\n"
"RECEIVI : D), subject to individually determined rates or contracts ihat The carrier shall not make delivery of this shipment without payment of\n"
"lave been agreed upon in writing between the carrier and shipper; if freight and all other lawful charges\n"
"applicable, otherwise to the rates; classifications and rules that\n"
"have been established by the carrier and arc available to the shipper, Shipper\n"
"on\"request, and to all applicable provincial and fcderal regulations. Signature\n"
"SHIPPER SIGNATURE / DATE Trailer Loaded : Freight Counted : Carrier acknowledges rcccipt of packages and required\n"
"This is to certify that the above named materials placards. Carrier certifies emergency response\n"
"arc properly classificd, packaged, marked and By Shipper By Shipper information was made available and/or carrier has the\n"
"|labeled, and are in proper condition for Driver By Driver pallets DOT emergency response guide book or equivalent\n"
"对 By documentation in the vehidic 6216-21\n"
"transportation according to the applicable said to contain 148\n"
"regulations for the DOT ByDriver / Pieces per te doen parle defectived po pod pritet\n"
"Osaid\n"
"Remittance AddressSendall Name &\n"
"Prepaid Bills Parker Hannifin C/o Cass Information Systems P.O. Box 67 St. Louis, MO 63166")
matches = re.finditer(regex, test_str, re.MULTILINE)
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