# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^.*250 g<\/td><td><span[^>]*>([0-9]+)\.([0-9]+[0-9]+[0-9]+)\,([0-9]+[0-9]+)<\/span>.*$"
test_str = " <div id=\"content\" class=\"s1\"><!--TYPO3SEARCH_begin--><div id=\"c27140\" class=\"csc-default\"><h1>Preise für Goldbarren, Silberbarren, Platinbarren und Palladiumbarren</h1><p class=\"bodytext\">Alle Ankauf-Preise in Euro. ESG-Schalterankaufspreise vom 10.07.2015 / <span title=\"date-otc\">10.07.2015</span>.</p><table class=\"quotetable\"> <thead> <tr><th>Barren</th> <th scope=\"col\">Gold<br /><img src=\"fileadmin/_migrated/RTE/RTEmagicC_gold_small_02.png.png\" title=\"gold small\" txdam=\"1005\" height=\"52\" width=\"70\" alt=\"\" /></th> <th scope=\"col\">Silber<br /><img src=\"fileadmin/_migrated/RTE/RTEmagicC_silver_small_02.png.png\" title=\"silver small\" txdam=\"1008\" height=\"52\" width=\"70\" alt=\"\" /></th> <th scope=\"col\">Palladium<br /><img src=\"fileadmin/_migrated/RTE/RTEmagicC_palladium_small_02.png.png\" title=\"palladium small\" txdam=\"1006\" height=\"52\" width=\"70\" alt=\"\" /></th> <th scope=\"col\">Platin<br /><img src=\"fileadmin/_migrated/RTE/RTEmagicC_platinum_small_02.png.png\" title=\"platinum small\" txdam=\"1007\" height=\"52\" width=\"70\" alt=\"\" /></th> </tr> </thead> <tbody> <tr class=\"impair\"> <td class=\"th\">1 g</td><td><span title=\"01011011-otc\">33,43</span> €</td><td><span title=\"10201714-otc\">0,44</span> €</td><td><span title=\"10201762-otc\">17,90</span> €</td><td><span title=\"10201752-otc\">28,64</span> €</td></tr> <tr><td class=\"th\">5 g</td><td><span title=\"01011021-otc\">167,16</span> €</td><td><span title=\"10201715-otc\">2,22</span> €</td><td><span title=\"10201763-otc\">89,53</span> €</td><td><span title=\"10201753-otc\">143,22</span> €</td></tr> <tr class=\"impair\"><td class=\"th\">10 g</td><td><span title=\"01011031-otc\">334,33</span> €</td><td><span title=\"10201716-otc\">4,45</span> €</td><td><span title=\"10201764-otc\">179,06</span> €</td><td><span title=\"10201754-otc\">286,44</span> €</td></tr> <tr><td class=\"th\">20 g</td><td><span title=\"01011041-otc\">668,66</span> €</td><td><span title=\"10201720-otc\">8,91</span> €</td><td><span title=\"10201765-otc\">358,12</span> €</td><td><span title=\"10201755-otc\">572,88</span> €</td></tr> <tr class=\"impair\"><td class=\"th\"><p class=\"align-right\"><b>1 oz </b></p><p class=\"align-right\"><b>(31,10 g)<br /></b></p></td><td><b><span title=\"01011051-otc\">1.039,78</span> €<br /></b></td><td><b><span title=\"10201893-otc\">13,86</span> €<br /></b></td><td><b><span title=\"10201766-otc\">556,88</span> €<br /></b></td><td><b><span title=\"10201756-otc\">890,84</span> €<br /></b></td></tr> <tr><td class=\"th\">50 g</td><td><span title=\"01011061-otc\">1.671,67</span> €</td><td><span title=\"10201721-otc\">22,29</span> €</td><td><span title=\"10201767-otc\">895,31</span> € </td><td><span title=\"10201757-otc\">1.432,22</span> €</td></tr> <tr class=\"impair\"><td class=\"th\">100 g</td><td><span title=\"01011071-otc\">3.343,34</span> €</td><td><span title=\"10201722-otc\">44,59</span> €</td><td><span title=\"10201768-otc\">1.790,62</span> €</td><td><span title=\"10201758-otc\">2.864,44</span> €</td></tr> <tr><td class=\"th\">250 g</td><td><span title=\"01011081-otc\">8.358,36</span> €</td><td><span title=\"10201723-otc\">111,49</span> €</td><td><span title=\"10201769-otc\">4.476,55</span> €</td><td><span title=\"10201759-otc\">7.161,10</span> €</td></tr> <tr class=\"impair\"><td class=\"th\">500 g</td><td><span title=\"01011091-otc\">16.716,73</span> €</td><td><span title=\"10201724-otc\">222,99</span> €</td><td><span title=\"10201770-otc\">8.953,11</span> €</td><td><span title=\"10201760-otc\">14.322,21</span> €</td></tr> <tr><td class=\"th\">1000 g</td><td><span title=\"01011101-otc\">33.433,47</span> €</td><td><span title=\"10201725-otc\">445,98</span> €</td><td><span title=\"10201771-otc\">17.906,23</span> €</td><td><span title=\"10201761-otc\">28.644,42</span> €</td></tr></tbody></table><ul><li>1oz = 1 Unze = 31,10g</li><li>Maßgeblich für den Gutschriftsbetrag / Auszahlungsbetrag ist jeweils der Tageskurs bei Barreneingang in unserem Hause) </li></ul></div><div class=\"csc-default\"><div class=\"divider\"><hr /></div></div><div id=\"c12890\" class=\"csc-default\"><div class=\"yui-g\">"
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