-2

I have a string like this "<RC_EMAIL:someone@gmail.com> some other content…". I want to extract only the "someone@gmail.com" and display it in frontend. The string can contain any number of templates like this. I'm not able to use replaceAll("<RC_EMAIL:", ""), since it is give me result as "'someone@gmail.com>'. Can we do this with regex? or just with replaceAll method?

Hari Krishnan
  • 191
  • 1
  • 1
  • 8

1 Answers1

0
let email = "<RC_EMAIL:someone@gmail.com> some other content…".replace(/<\w+:([^>]+?)>/g,"$1");
Ephellon Grey
  • 392
  • 2
  • 9