#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?mu)^(\w{4,}?)(?:es|s|e|x)$"
Local $sString = "I am trying to delete all word suffixes -es, -s, -e or -x of all words that have at least 4 characters after removing the suffix, using regex in Python." & @CRLF & _
"" & @CRLF & _
"There are some examples of desired output (in French):" & @CRLF & _
"" & @CRLF & _
"technologiques" & @CRLF & _
"→ technologiqu" & @CRLF & _
"pares" & @CRLF & _
" → pare (the word is too small so it does not remove the "es", only the "s")" & @CRLF & _
"bas" & @CRLF & _
" → bas (the word is too small so it does not do anything)" & @CRLF & _
"matériaux" & @CRLF & _
" → materiau" & @CRLF & _
"sièges" & @CRLF & _
" → sieg" & @CRLF & _
"siege" & @CRLF & _
" → sieg" & @CRLF & _
"feuilletées" & @CRLF & _
" → feuilleté" & @CRLF & _
"dos" & @CRLF & _
" → dos" & @CRLF & _
""
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