Created
August 27, 2023 15:05
-
-
Save 0187773933/4c3c837d77afad00b8460f058a7cdb20 to your computer and use it in GitHub Desktop.
Pilot Class List Email Extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( ()=> { | |
const listElement = document.getElementById('BccAddresses$control'); | |
const listItems = listElement.querySelectorAll('.d2l-multiselect-choice span'); | |
const emailArray = []; | |
listItems.forEach((item) => { | |
const text = item.innerText; | |
const match = text.match(/"(.+)" <(.+)>/); | |
if (match) { | |
emailArray.push(`"${match[1]}" <${match[2]}>`); | |
} | |
}); | |
const emailString = emailArray.join(', '); | |
console.log(emailString); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment