I am working on creating a Regex rule to validate if a value matches a Donorbox Embed Form. This validation is important to confirm that the user input codes are indeed from Donorbox.
Here is an example of a Donorbox EmbedForm:
<script src="https://donorbox.org/widget.js" paypalExpress="false"></script>
<iframe src="https://donorbox.org/embed/..." allowpaymentrequest="" frameborder="0"></iframe>
The regex needs to check for both script and iframe tags, then analyze the src attributes in order to validate the domain.
So far, my progress looks like this:
<textarea (change)="donorBoxEmbedFormVerification(e)" type="text"></textarea>
donorBoxEmbedFormVerification(embedHtml: string):boolean {
// need some help
console.log(embedHtml.match('<\s*script[^>]*>(.*?)<\s*/\s*script>'));
return true;
}
Any assistance with crafting the regex would be greatly appreciated,
Best regards,
Samantha