#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)^(Prefeitura|Pref\.|P\.)\s(Municipal\s?|Mun.\s?|M.\s?)?(de\s)?(S[aã]o\sPaulo|S.\sP.|S.\sPaulo|S.P.|SP)$" & @CRLF & _
""
Local $sString = "Prefeitura Municipal de São Paulo" & @CRLF & _
"Prefeitura Municipal de Sao Paulo" & @CRLF & _
"Prefeitura de São Paulo" & @CRLF & _
"Prefeitura de Sao Paulo" & @CRLF & _
"Prefeitura Mun. de São Paulo" & @CRLF & _
"Pref. Mun. de São Paulo" & @CRLF & _
"Pref. Mun. de S. P." & @CRLF & _
"Pref. de São Paulo" & @CRLF & _
"Pref. de S. Paulo" & @CRLF & _
"Pref. M. de São Paulo" & @CRLF & _
"P. M. de Sao Paulo" & @CRLF & _
"Prefeitura São Paulo" & @CRLF & _
"Pref. Mun. São Paulo" & @CRLF & _
"Pref. Mun. S. Paulo" & @CRLF & _
"Prefeitura de S.P." & @CRLF & _
"Prefeitura de SP"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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