# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?<=parsable-cite=\\\")\w{2}\/\d{3}\/\d{3}"
test_str = "{\"billnumber\": \"499\", \"billbody\": \"<bill bill-stage=\\\"Introduced-in-Senate\\\" public-private=\\\"public\\\">\\n <metadata xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\">\\n <dublinCore>\\n <dc:title>113 S499 IS: Patient Choice Restoration Act</dc:title>\\n <dc:publisher>U.S. Senate</dc:publisher>\\n <dc:date>2013-03-07</dc:date>\\n <dc:format>text/xml</dc:format>\\n <dc:language>EN</dc:language>\\n <dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>\\n </dublinCore>\\n </metadata>\\n <form>\\n <distribution-code display=\\\"yes\\\">II</distribution-code>\\n <congress>113th CONGRESS</congress>\\n <session>1st Session</session>\\n <legis-num>S. 499</legis-num>\\n <current-chamber>IN THE SENATE OF THE UNITED STATES</current-chamber>\\n <action>\\n <action-date date=\\\"20130307\\\">March 7, 2013</action-date>\\n <action-desc>\\n <sponsor name-id=\\\"S299\\\">Mr. Vitter</sponsor>(for himself\\n\\t\\t\\t and<cosponsor name-id=\\\"S355\\\">Mr. Cruz</cosponsor>) introduced the following\\n\\t\\t\\t bill; which was read twice and referred to the<committee-name committee-id=\\\"SSFI00\\\">Committee on\\n\\t\\t\\t Finance</committee-name>\\n </action-desc>\\n </action>\\n <legis-type>A BILL</legis-type>\\n <official-title>To repeal the Patient Protection and Affordable Care\\n\\t\\t Act.</official-title>\\n </form>\\n <legis-body>\\n <section id=\\\"id6D79D62AF466494398FF5FE90F4B4C54\\\" section-type=\\\"section-one\\\">\\n <enum>1.</enum>\\n <header>Short title</header>\\n <text display-inline=\\\"no-display-inline\\\">This Act may be cited as the<quote>\\n <short-title>Patient Choice Restoration\\n\\t\\t\\t Act</short-title>\\n </quote>.</text>\\n </section>\\n <section id=\\\"idCD2A3EA9F06D44988B7B6592EC5A1643\\\" section-type=\\\"subsequent-section\\\">\\n <enum>2.</enum>\\n <header>Repeal</header>\\n <subsection id=\\\"idCEB3A1D87FE64817A5F57C139C2503BA\\\">\\n <enum>(a)</enum>\\n <header>In\\n\\t\\t\\t general</header>\\n <text display-inline=\\\"yes-display-inline\\\">The following Acts,\\n\\t\\t\\t and the amendments made by such Acts, are repealed:</text>\\n <paragraph id=\\\"idF23F83A55FFE4D6BBDD8E6A089D8E9A5\\\">\\n <enum>(1)</enum>\\n <text display-inline=\\\"yes-display-inline\\\">The<cato:entity xmlns:cato=\\\"http://namespaces.cato.org/catoxml\\\" entity-type=\\\"law-citation\\\">\\n <cato:entity-ref entity-type=\\\"act\\\" value=\\\"Patient Protection and Affordable Care Act\\\">Patient Protection and Affordable Care\\n\\t\\t\\t Act</cato:entity-ref>(<external-xref legal-doc=\\\"public-law\\\" parsable-cite=\\\"pl/111/148\\\">Public Law 111\\u2013148</external-xref>)</cato:entity>.</text>\\n </paragraph>\\n <paragraph id=\\\"id2BD61EF1ED3E451182DDEDD02FFC6850\\\">\\n <enum>(2)</enum>\\n <text display-inline=\\\"yes-display-inline\\\">The<cato:entity xmlns:cato=\\\"http://namespaces.cato.org/catoxml\\\" entity-type=\\\"law-citation\\\">\\n <cato:entity-ref entity-type=\\\"act\\\" value=\\\"Health Care and Education Reconciliation Act of 2010\\\">Health Care and Education\\n\\t\\t\\t Reconciliation Act of 2010</cato:entity-ref>(<external-xref legal-doc=\\\"public-law\\\" parsable-cite=\\\"pl/111/152\\\">Public Law 111\\u2013152</external-xref>)</cato:entity>.</text>\\n </paragraph>\\n </subsection>\\n <subsection id=\\\"idE7C3196B19BF4FBC9B58ED08B87DBAC3\\\">\\n <enum>(b)</enum>\\n <header>Effect of\\n\\t\\t\\t law</header>\\n <text>The provisions of law amended by the Acts referred to in<cato:entity-ref xmlns:cato=\\\"http://namespaces.cato.org/catoxml\\\" entity-type=\\\"act\\\" value=\\\"Patient Choice Restoration Act/s:2/ss:a\\\" proposed=\\\"true\\\">subsection (a)</cato:entity-ref>are restored as if such Acts had never been enacted.</text>\\n </subsection>\\n </section>\\n </legis-body>\\n</bill>\", \"billversion\": \"is\", \"congress\": \"113\", \"billtype\": \"s\"}"
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