- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:06 AM
Hi there,
I am very new to creating Flows and the like so I am sure this is super simple.
I wondering how I would capture an e-mail from a block of text such as:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac diam sed turpis laoreet viverra id quis velit. Suspendisse auctor turpis ac ipsum test.user@service-now.org fermentum auctor. Quisque velit augue, aliquam tempor fringilla quis, ultricies quis ante. Sed ac euismod massa. Proin eget maximus leo. Aenean interdum est lorem, venenatis sollicitudin ligula."
I have been trying to search for the ability to do this but can't see anyone answering this.
Thank you for any help you can give.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 04:20 AM - edited 07-05-2024 04:21 AM
You will need a bit of code to achieve this, for example this should work:
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac diam sed turpis laoreet viverra id quis velit. Suspendisse auctor turpis ac ipsum test.user@service-now.org fermentum auctor. Quisque velit augue, aliquam tempor fringilla quis, ultricies quis ante. Sed ac euismod massa. Proin eget maximus leo. Aenean interdum est lorem, venenatis sollicitudin ligula.";
var emails = text.match(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
return emails[0];
This will extract the first email found in the text. You can enter this code in a relevant action in Flow Designer (e.g. Log) to test it.
var emails = fd_data.flow_var.text.match(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
return emails[0];
Hope this helps,
Lukasz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 04:20 AM - edited 07-05-2024 04:21 AM
You will need a bit of code to achieve this, for example this should work:
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac diam sed turpis laoreet viverra id quis velit. Suspendisse auctor turpis ac ipsum test.user@service-now.org fermentum auctor. Quisque velit augue, aliquam tempor fringilla quis, ultricies quis ante. Sed ac euismod massa. Proin eget maximus leo. Aenean interdum est lorem, venenatis sollicitudin ligula.";
var emails = text.match(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
return emails[0];
This will extract the first email found in the text. You can enter this code in a relevant action in Flow Designer (e.g. Log) to test it.
var emails = fd_data.flow_var.text.match(/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
return emails[0];
Hope this helps,
Lukasz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 01:42 AM
Hi there Lukasz,
This information was exactly what I was looking for!
Thank you so much for your help with this. ^^
Kind Regards,
Iain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 07:55 AM
That's great to hear and happy to help!
Lukasz