@REGEXSUB[n,expression,string] - returns the "nth" matching group in the string. (If you don't specify a group in expression, @REGEXSUB will return an empty string.)  The expression must be enclosed in double quotes if it contains any separator characters (space, comma, or tab). See Regular Expression Syntax for supported expressions.

 

Examples:

 

echo %@regexsub[2,(\w+)\s(\1)\W,"She said that that was not correct."]

that

 

echo %@regexsub[0,(\w+\.)+\w+,"users.mail.com"]

users.mail.com

 

echo %@regexsub[1,(\w+\.)+\w+,"users.mail.com"]

mail.