#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\[([A-Z]*(?:(?:.*|\h*)[A-Z0-9][a-z]*)*)\]"
Local $sString = "Exclude the following:" & @CRLF & _
"[Ki-Woo]" & @CRLF & _
"[Drunk]" & @CRLF & _
"[Woman 1]" & @CRLF & _
"[Dr. Freeman]" & @CRLF & _
"[Dr. West]" & @CRLF & _
"[Anne Marie O'Donnell]" & @CRLF & _
"[Anne-Marie O'Donnell]" & @CRLF & _
"[Gary Wells]" & @CRLF & _
"[Gary L. Wells]" & @CRLF & _
"[R. H. Brown]" & @CRLF & _
"[Roger H. Brown]" & @CRLF & _
"[J. Edgar Hover]" & @CRLF & _
"Exclude ones starting with lowercase:" & @CRLF & _
"[young Ashley]" & @CRLF & _
"[reporter 1]" & @CRLF & _
"[woman 1]"
Local $sSubst = "$1\:"
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