#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)( `\n)( query \{\n)( .*)(\{\n)( (.|\n|)[^;]*)( \}\n)( \}\n)( `)"
Local $sString = "import { gql } from '@apollo/client';" & @CRLF & _
"" & @CRLF & _
"const getAccountingSubject = gql(" & @CRLF & _
" `" & @CRLF & _
" query {" & @CRLF & _
" accountingSubjects {" & @CRLF & _
" id" & @CRLF & _
" accountingSubjectNumber" & @CRLF & _
" accountingSubjectTypeId" & @CRLF & _
" accountingSubjectType {" & @CRLF & _
" name" & @CRLF & _
" code" & @CRLF & _
" }" & @CRLF & _
" accountingSubjectPrefixCodeId" & @CRLF & _
" accountingSubjectCompanyType" & @CRLF & _
" name" & @CRLF & _
" note" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" `," & @CRLF & _
");" & @CRLF & _
"" & @CRLF & _
"const getAccountingSubjectById = (id) =>" & @CRLF & _
" gql(" & @CRLF & _
" `" & @CRLF & _
" query {" & @CRLF & _
" accountingSubjects (where: {id: {eq: ${id}}}) {" & @CRLF & _
" id" & @CRLF & _
" accountingSubjectNumber" & @CRLF & _
" accountingSubjectTypeId" & @CRLF & _
" accountingSubjectType {" & @CRLF & _
" name" & @CRLF & _
" code" & @CRLF & _
" }" & @CRLF & _
" accountingSubjectPrefixCodeId" & @CRLF & _
" accountingSubjectCompanyType" & @CRLF & _
" name" & @CRLF & _
" note" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" `," & @CRLF & _
" );" & @CRLF & _
"" & @CRLF & _
"export default {" & @CRLF & _
" getAccountingSubject," & @CRLF & _
" getAccountingSubjectById," & @CRLF & _
"};" & @CRLF & _
""
Local $sSubst = "$1$2$3{\n totalCount\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n item $4 $5 }\n$7$8$9"
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