0

I have some database upgrade to do, and I have to find email address from a description/tagline string.

String sample :

Fashion business\n\ud83c\udf38 DM for collab\n\ud83c\udf38email.adresse@gmail.com\n\ud83c\udf

This is what the string look like on Rails Console : enter image description here

How can I extract "email.adresse@gmail.com" from this string? Thanks

Gregdebrick
  • 533
  • 6
  • 14

1 Answers1

1

Answer found in a Java post but translated to rails it would be :

string = Fashion business\n\ud83c\udf38 DM for collab\n\ud83c\udf38email.adresse@gmail.com\n\ud83c\udf

email = string.scan(/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i)

email = email.adresse@gmail.com

Thanks for you answers

Gregdebrick
  • 533
  • 6
  • 14