You are viewing a single comment's thread. Return to all comments →
JavaScript
function checkEmail(email) { const regExp = new RegExp('^[a-z](\.?[a-z]){1,50}@gmail\.com$'); return regExp.test(email) } function main() { const N = parseInt(readLine().trim(), 10); const res = []; for (let NItr = 0; NItr < N; NItr++) { const firstMultipleInput = readLine().replace(/\s+$/g, '').split(' '); const firstName = firstMultipleInput[0]; const emailID = firstMultipleInput[1]; if(checkEmail(emailID)) { res.push(firstName); }; } res.sort().forEach(e => console.log(e)); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 28: RegEx, Patterns, and Intro to Databases
You are viewing a single comment's thread. Return to all comments →
JavaScript