# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(\{.*\})"
test_str = "Email Newsletter@media only screen and (max-width: 415px) {table[class=\\\"main-table\\\"],table[class=\\\"main-table\\\"] .image {width: 100% !important;}table[class=\\\"main-table\\\"] .image {max-width:100% !important;height:auto !important;}table[class=\\\"main-table\\\"] .row {display:block !important;width:100% !important;margin-bottom:20px !important;}table[class=\\\"main-table\\\"] .row .separator {width:20px !important;}table[class=\\\"main-table\\\"] .mobile {display: none !important;}table[class=\\\"main-table\\\"] .block{display: block !important;}table[class=\\\"main-table\\\"] .top-menu{width: 25% !important;}}Thank you for considering the Acura RDX. Check out the latest videos, features, and details from the Acura RDX below.VIEW IN BROWSERNew InventoryCertified Pre-Owned InventoryLease & FinanceHelloThank you for considering the Acura RDX. Check out the latest videos, features, and details from the Acura RDX below.TRIMS & COLORSPHOTO GALLERY360° TOURVIDEOSFEATURESSPECIFICATIONSCOMPETITIVE COMPARISONBUILD AND PRICERDXStarting at $35,270MSRP includes destination and handling279-hp, 3.5-liter, i-VTEC® V-66-spd. Sequential SportShift paddle shiftersFront-wheel driveJewel Eye® LED headlightsRDX with Technology and AcuraWatch Plus PackagesStarting at$40,270MSRP includes destination and handlingCollision Mitigation Braking System™ (CMBS™)Lane Keeping Assist System (LKAS)59Color Multi-information display (MID)Adaptive Cruise Control (ACC)53RDX AWD with Advance PackageStarting at $43,420MSRP includes destination and handlingAWD with Intelligent Control System™9655 SW Canyon RoadPortland, OR97225SALES (866) 985-5966SERVICE (866) 980-4615PARTS (877) 245-7434MSRP includes destination and handlingTO OPT-DOWN OR UNSUBSCRIBE: This e-mail was sent to you because you area valued Ron Tonkin Acura customer. To receive fewer updates or removeyourself from our e-mail program, please unsubscribe."
matches = re.search(regex, test_str)
if matches:
print ("Match was found at {start}-{end}: {match}".format(start = matches.start(), end = matches.end(), match = matches.group()))
for groupNum in range(0, len(matches.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = matches.start(groupNum), end = matches.end(groupNum), group = matches.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