JSFiddle - React, Tailwind, and code Playground

by Scott Kaye

HTML

<div id="test">
    WCF Guidance
Keep in mind that the only safe way to pass a request in RESTful services is via HTTP POST, with TLS enabled. GETs are visible in the querystring, and a lack of TLS means the body can be intercepted.
Avoid BasicHttpBinding. It has no default security configuration. Use WSHttpBinding instead.
Use at least two security modes for your binding. Message security includes security provisions in the headers. Transport security means use of SSL. TransportWithMessageCredential combines the two.
Test your WCF implementation with a fuzzer like the Zed Attack Proxy.
Authors and Primary Editors
Bill Sempf - bill.sempf(at)owasp.org
Troy Hunt - troyhunt(at)hotmail.com
Jeremy Long - jeremy.long(at)owasp.org
</div>

JavaScript

var str = document.getElementById("test").innerText;

function getEmails(str) {
    RegExp.escape = function (s) {
        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
    };

    var surrounds = ["[]", "{}", "()"];

    var inners = {
        "at": "@",
        "dot": ".",
        "period": "."
    };

    Object.keys(inners).forEach(function (r) {
        surrounds.forEach(function (s) {
            var ent = [s[0], r, s[1]].join("");
            var expr = new RegExp("[\\s+]?(" + RegExp.escape(ent) + ")[\\s+]?", "gi");
            str = str.replace(expr, "$1");
            str = str.replace(new RegExp(RegExp.escape(ent), "gi"), inners[r]);
        });
    });

    //Greedy email regex from http://stackoverflow.com/a/15050961/382456
    var emails = str.match(/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/gi);
    return emails;
}

console.clear();
var e = getEmails(str);
console.log(e);