How to extract email address from string field with a custom function?

How to extract email address from string field with a custom function?

Hi Support,

Current Functionality
I have a flow in Zoho Flow that receives information via a JSON webhook POST and then updates/creates records using this information into Zoho CRM. A specific piece of that information is "comments" which is pushed to a field in Zoho CRM called "comments".

What I Want
An example of the comments string field below:



I want to be able to extract the email address from the comments field and place it into the email field (or any other alternative as long as I can extract the email address) which will lookup and associate any accounts and contacts. How can I do this with a script? Maybe a script that can extract all the text between the commas (,) which have an "@" sign?

N.B. The information in the comments can come in any order.

Let me know what is possible and thanks.

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now