#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?i)([\s\S]*?)[\s]*def (\w+)Impl\((.*)\):[\s]+"""[\s]+([\s\S]*?)[\s]+"""([\s\S]*?)((def|$)[\s\S]*)$"
Local $sString = "def TestUnParamImpl(param1):" & @CRLF & _
" """" & @CRLF & _
" @param param1 string Param named param1" & @CRLF & _
" @return return1 string Return named return1" & @CRLF & _
" """" & @CRLF & _
" " & @CRLF & _
" """" & @CRLF & _
" # Imported code :" & @CRLF & _
" " & @CRLF & _
" import json" & @CRLF & _
" d = json.loads(jsonstr)" & @CRLF & _
"" & @CRLF & _
" # To use the input params, simply use d["param1"] " & @CRLF & _
" # Your code here" & @CRLF & _
"" & @CRLF & _
" ret_dict = {}" & @CRLF & _
" ret_dict["return1"] = """ & @CRLF & _
" return json.dumps(ret_dict)" & @CRLF & _
" """" & @CRLF & _
" " & @CRLF & _
" return {" & @CRLF & _
" "return1": "string"" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
"def TestDeuxParamsImpl(paramString, paramInt):" & @CRLF & _
" """" & @CRLF & _
" @param paramString string Param named paramString" & @CRLF & _
" @param paramInt integer Param named paramInt" & @CRLF & _
" @return returnString string Return named returnString" & @CRLF & _
" @return returnInt integer Return named returnInt" & @CRLF & _
" """" & @CRLF & _
" " & @CRLF & _
" """" & @CRLF & _
" # Imported code :" & @CRLF & _
" " & @CRLF & _
" import json" & @CRLF & _
" d = json.loads(jsonstr)" & @CRLF & _
"" & @CRLF & _
" # To use the input params, simply use d["paramString"] d["paramInt"] " & @CRLF & _
" # Your code here" & @CRLF & _
"" & @CRLF & _
" ret_dict = {}" & @CRLF & _
" ret_dict["returnString"] = """ & @CRLF & _
" ret_dict["returnInt"] = """ & @CRLF & _
" return json.dumps(ret_dict)" & @CRLF & _
" """" & @CRLF & _
" " & @CRLF & _
" return {" & @CRLF & _
" "returnString": "string"," & @CRLF & _
" "returnInt": "integer"" & @CRLF & _
" }" & @CRLF & _
" "
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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