Extract email address from string in Javascript (Google Tag manager function)

I’m looking for a way to extract the email address from a string I have already stored in a Google Tag Manager variable. I’m new with Javascript and I tried some functions I found on the internet but …

Enhanced Ecommerce dataLayer WooCommerce

I’m trying to set up a dataLayer for WooCommerce Thank you page. Look here what I’ve done so far (the variables are not completely set up yet): function dataLayer_google_gtm( $order_id ) { // …