How to extract text between <> characters (server action)

I have data coming into a server action that I am saving to a DB.

The data coming in is in this format: steve b <steve@example.com>

I need to extract only the email address between the <> characters so in this case I just want to extract steve@example.com

I know this probably has something to do with using sub string formatting but I am having trouble figuring it out. Can anyone help?

1 Like

After slamming my head against the keyboard I figured it out (and obliviously its very simple) for anyone else whoever runs into this I used the split formatter twice.

Put the following after whatever string you want to grab the text between <>.

.split(’<’)[1].split(’>’)[0]

3 Likes