You're welcome 🙂

Function match of a String means look for the patter in the string and return each find. The pattern, also called Regular Expression mean look for a sub-string that matches the rules:

- a line starting with text: From:

- followed by any number of white spaces: \s*

- followed by at least one of any kind of character: .+

- followed by any number of white spaces: \s*

- followed by a less-than character: <

- turn on capturing: (

- followed by at least one character that is neither less-than nor greater than: [^<>]+

- turn off capturing: )

- followed by a greater-than character: >

- followed by the end of a line

Capturing means that function match, in addition to returning the whole matched result, shall also return separately whatever fall between capturing delimiters. In our case the e-mail is captured.

To be honest, this could be simplified to:

 

/^From:.+<([^<>]+)>$/mi

 

Because we are no longer interested in anything (e.g. name) but the e-mail at the end.