I want to know if by using regular expressions I am able to extract emails from the following strings?
The following RE pattern is .*@.*
match with all st
Hi this regex is not working for me ......
let items1 = document.querySelectorAll('h1');
items1.forEach((item) => {
let pattern = (/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi)
if (item.innerHTML.match(pattern)) {
results.push({
emailId: item.innerHTML
});
}
});
This is the tag from which i am getting the text...Just a eg.
"dasd xyz@gmail.com asdas asdsad asdasd"
This is the object output that I am getting.
[
{ emailId: 'sadasdsa br@gmail.com' },
{ emailId: 'sadasd br2@gmail.com' },
{ emailId: '"asgdb@gmail.com"' },
{ emailId: '"dasd xyz@gmail.com asdas"' },
{ emailId: 'asgdb@gmail.com' }
]