# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"<form.+action=\"(.*?)\".*>\n.*?<input.*?value=\"(.*?)\".*>\n.*?<input.*?value=\"(.*?)\".*>\n.*?<input.*?value=\"(.*?)\"|<input id=\"(.*?)\"|<input name=\"(.*?)\""
test_str = ("<form accept-charset=\"UTF-8\" action=\"https://appname.infusionsoft.com/app/form/process/6488f3cca2ac451a9d4f416c48f4c3bc\" class=\"infusion-form\" id=\"inf_form_6488f3cca2ac451a9d4f416c48f4c3bc\" method=\"POST\">\n"
" <input name=\"inf_form_xid\" type=\"hidden\" value=\"6488f3cca2ac451a9d4f416c48f4c3bc\" />\n"
" <input name=\"inf_form_name\" type=\"hidden\" value=\"Regex Text Webform\" />\n"
" <input name=\"infusionsoft_version\" type=\"hidden\" value=\"1.70.0.369835\" />\n"
" <div class=\"infusion-field\">\n"
" <label for=\"inf_field_FirstName\">Vorname</label>\n"
" <input id=\"inf_field_FirstName\" name=\"inf_field_FirstName\" placeholder=\"Vorname\" type=\"text\" />\n"
" </div>\n"
" <div class=\"infusion-field\">\n"
" <label for=\"inf_field_Email\">Email *</label>\n"
" <input id=\"inf_field_Email\" name=\"inf_field_Email\" placeholder=\"Email *\" type=\"text\" />\n"
" </div>\n"
" <div class=\"infusion-field\">\n"
" <label for=\"inf_field_Phone1\">Phone 1</label>\n"
" <input id=\"inf_field_Phone1\" name=\"inf_field_Phone1\" placeholder=\"Phone 1\" type=\"text\" />\n"
" </div>\n"
" <div class=\"infusion-field\">\n"
" <label for=\"inf_custom_WebinarTitel0\">Webinar Titel</label>\n"
" <input id=\"inf_custom_WebinarTitel0\" name=\"inf_custom_WebinarTitel0\" placeholder=\"Webinar Titel\" type=\"text\" />\n"
" </div>\n"
" <div class=\"infusion-field\">\n"
" <label for=\"inf_custom_WebinarTeilnahmelink0\">Webinar Teilnahmelink *</label>\n"
" <input id=\"inf_custom_WebinarTeilnahmelink0\" name=\"inf_custom_WebinarTeilnahmelink0\" placeholder=\"Webinar Teilnahmelink *\" type=\"text\" />\n"
" </div>\n"
" <input name=\"inf_field_LeadSourceId\" type=\"hidden\" value=\"null\" />\n"
" <input name=\"inf_custom_Quelle\" type=\"hidden\" value=\"null\" />\n"
" <div>\n"
" <div> </div>\n"
" </div>\n"
" <div class=\"infusion-submit\">\n"
" <button class=\"infusion-recaptcha\" id=\"recaptcha_6488f3cca2ac451a9d4f416c48f4c3bc\" type=\"submit\">Los gehts!</button>\n"
" </div>\n"
"</form>\n"
"<script type=\"text/javascript\" src=\"https://appname.infusionsoft.app/app/webTracking/getTrackingCode\"></script>\n"
"<script type=\"text/javascript\" src=\"https://appname.infusionsoft.com/resources/external/recaptcha/production/recaptcha.js?b=1.70.0.369835-hf-202106081103\"></script>\n"
"<script src=\"https://www.google.com/recaptcha/api.js?onload=onloadInfusionRecaptchaCallback&render=explicit\" async=\"async\" defer=\"defer\"></script>\n"
"<script type=\"text/javascript\" src=\"https://appname.infusionsoft.com/app/timezone/timezoneInputJs?xid=6488f3cca2ac451a9d4f416c48f4c3bc\"></script>\n"
"<script type=\"text/javascript\" src=\"https://appname.infusionsoft.com/js/jquery/jquery-3.3.1.js\"></script>\n"
"<script type=\"text/javascript\" src=\"https://appname.infusionsoft.app/app/webform/overwriteRefererJs\"></script>")
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