#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^\s*\?\s*(.*?)\s+\d+(?:\.\d+)?[kM]?"
Local $sString = " ? 5girls 57k" & @CRLF & _
"? acoustic guitar 1.4k" & @CRLF & _
"? bass guitar 4.2k" & @CRLF & _
"? black choker 144k" & @CRLF & _
"? black dress 227k" & @CRLF & _
"? black footwear 275k" & @CRLF & _
"? black pants 133k" & @CRLF & _
"? black ribbon 128k" & @CRLF & _
"? black shirt 201k" & @CRLF & _
"? black shorts 117k" & @CRLF & _
"? blue eyes 1.7M "
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