#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(^\.)?((?<=\.?)\/src)|(src\/)"
Local $sString = "src/abc" & @CRLF & _
"src/abc/bxc" & @CRLF & _
"bxc/src/abc" & @CRLF & _
"/src/src/abc" & @CRLF & _
"/src/abc" & @CRLF & _
"npx src/icons" & @CRLF & _
"node /src/icons" & @CRLF & _
"node bxc/src/icons" & @CRLF & _
"node /bxc/src/icons" & @CRLF & _
"node /bxc/icons" & @CRLF & _
"node /src/plugins" & @CRLF & _
"/src" & @CRLF & _
"src" & @CRLF & _
"src/" & @CRLF & _
"./src" & @CRLF & _
"" & @CRLF & _
""build:icons": "tsx /src/plugins/iconify/build-icons.ts"," & @CRLF & _
""build:icons": "tsx src/plugins/iconify/build-icons.ts"," & @CRLF & _
"'@axios': fileURLToPath(new URL('./src/plugins/axios', import.meta.url)),"
Local $sSubst = ""
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