2021-07-01 17:25:48 -04:00

24 lines
961 B
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html><head><title>Complete JavaScript Course</title></head>
<body>
        <textarea name="txtarea" rows=2 cols=50></textarea> <button>Get Emails</button>>
        <textarea name="txtarea2" rows=2 cols=50></textarea>
<script>
const firstArea = document.querySelector("textarea[name='txtarea']");
const secArea = document.querySelector("textarea[name='txtarea2']");
document.querySelector("button").addEventListener("click", lookUp);
function lookUp() {
const rawTxt = firstArea.value;
const eData = rawTxt.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
const holder = [];
for (let x = 0; x < eData.length; x++) {
if (holder.indexOf(eData[x]) == -1) {
holder.push(eData[x]);
}
}
secArea.value = holder.join(',');
}
</script>
</body>
</html>