#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(([A-Z])|([a-z]))(\w)?(\w*)(\W+)"
Local $sString = "Hello! How are you today?" & @CRLF & _
"My name is Nikhil, and I am here to have fun! And do all sorts of things today." & @CRLF & _
"Do you understand me?" & @CRLF & _
"YES! I TOTALLY "
Local $sSubst = "${2:+\U$4\L$5\L$1ay$6:\L$4\L$5\L$1ay$6}"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm