Added a trim

This commit is contained in:
Tiago Ribeiro
2023-11-27 11:06:05 +00:00
parent b1f07b877c
commit f36c63f1b2

View File

@@ -40,6 +40,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
const file = filesContent[0]; const file = filesContent[0];
const emails = file.content const emails = file.content
.split("\n") .split("\n")
.map((x) => x.trim())
.filter((x) => new RegExp(/^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$/).test(x)); .filter((x) => new RegExp(/^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$/).test(x));
if (emails.length === 0) { if (emails.length === 0) {