0

I stumbled across (?<=\@)(.*?)(?=\.) here on StackOverflow, but apparently possitive lookbehinds are not supported in JavaScript.

I modified it a little to use /(@)(.*?)(?=\.)/ and I can obtain the last part of an email.

My problem is now trying to extract the last part if there are two . characters.

For example:

const[x, y, lastPart]="[email protected]".match(/(@)(.*?)(?=\.)/) //lastPart = bar 
const[x, y, lastPart]="[email protected]".match(/(@)(.*?)(?=\.)/) //lastPart = mailinator

These cases work perfectly, but when I try with [email protected], I would like to extract my.domain and not my.

Sarvan Kumar
  • 926
  • 1
  • 11
  • 27
Dan
  • 779
  • 2
  • 8
  • 16

0 Answers0