const regex = /<form.+action="(.*?)".*>\n.*?<input.*?value="(.*?)".*>\n.*?<input.*?value="(.*?)".*>\n.*?<input.*?value="(.*?)"|<input id="(.*?)"|<input name="(.*?)"/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('<form.+action="(.*?)".*>\\n.*?<input.*?value="(.*?)".*>\\n.*?<input.*?value="(.*?)".*>\\n.*?<input.*?value="(.*?)"|<input id="(.*?)"|<input name="(.*?)"', 'gm')
const str = `<form accept-charset="UTF-8" action="https://appname.infusionsoft.com/app/form/process/6488f3cca2ac451a9d4f416c48f4c3bc" class="infusion-form" id="inf_form_6488f3cca2ac451a9d4f416c48f4c3bc" method="POST">
<input name="inf_form_xid" type="hidden" value="6488f3cca2ac451a9d4f416c48f4c3bc" />
<input name="inf_form_name" type="hidden" value="Regex Text Webform" />
<input name="infusionsoft_version" type="hidden" value="1.70.0.369835" />
<div class="infusion-field">
<label for="inf_field_FirstName">Vorname</label>
<input id="inf_field_FirstName" name="inf_field_FirstName" placeholder="Vorname" type="text" />
</div>
<div class="infusion-field">
<label for="inf_field_Email">Email *</label>
<input id="inf_field_Email" name="inf_field_Email" placeholder="Email *" type="text" />
</div>
<div class="infusion-field">
<label for="inf_field_Phone1">Phone 1</label>
<input id="inf_field_Phone1" name="inf_field_Phone1" placeholder="Phone 1" type="text" />
</div>
<div class="infusion-field">
<label for="inf_custom_WebinarTitel0">Webinar Titel</label>
<input id="inf_custom_WebinarTitel0" name="inf_custom_WebinarTitel0" placeholder="Webinar Titel" type="text" />
</div>
<div class="infusion-field">
<label for="inf_custom_WebinarTeilnahmelink0">Webinar Teilnahmelink *</label>
<input id="inf_custom_WebinarTeilnahmelink0" name="inf_custom_WebinarTeilnahmelink0" placeholder="Webinar Teilnahmelink *" type="text" />
</div>
<input name="inf_field_LeadSourceId" type="hidden" value="null" />
<input name="inf_custom_Quelle" type="hidden" value="null" />
<div>
<div> </div>
</div>
<div class="infusion-submit">
<button class="infusion-recaptcha" id="recaptcha_6488f3cca2ac451a9d4f416c48f4c3bc" type="submit">Los gehts!</button>
</div>
</form>
<script type="text/javascript" src="https://appname.infusionsoft.app/app/webTracking/getTrackingCode"></script>
<script type="text/javascript" src="https://appname.infusionsoft.com/resources/external/recaptcha/production/recaptcha.js?b=1.70.0.369835-hf-202106081103"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadInfusionRecaptchaCallback&render=explicit" async="async" defer="defer"></script>
<script type="text/javascript" src="https://appname.infusionsoft.com/app/timezone/timezoneInputJs?xid=6488f3cca2ac451a9d4f416c48f4c3bc"></script>
<script type="text/javascript" src="https://appname.infusionsoft.com/js/jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="https://appname.infusionsoft.app/app/webform/overwriteRefererJs"></script>`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions