#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)public ([\w><]+ [\w><]+\(\))\s+{[^}]+}"
Local $sString = "using System.Linq;" & @CRLF & _
"using NineYi.ERPV2.DA.AppDB.Tables;" & @CRLF & _
"" & @CRLF & _
"namespace NineYi.ERPV2.DA.Repositories.DbRepositories" & @CRLF & _
"{" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// AppDbRepository" & @CRLF & _
" /// </summary>" & @CRLF & _
" public class AppDbRepository : IAppDbRepository" & @CRLF & _
" {" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// AppDbContext" & @CRLF & _
" /// </summary>" & @CRLF & _
" private AppDbContext _appDbContext;" & @CRLF & _
"" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// Initializes a new instance of the <see cref="AppDbRepository" /> class." & @CRLF & _
" /// </summary>" & @CRLF & _
" /// <param name="appDbContext">AppDbContext</param>" & @CRLF & _
" public AppDbRepository(AppDbContext appDbContext)" & @CRLF & _
" {" & @CRLF & _
" this._appDbContext = appDbContext;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// SaveChanges" & @CRLF & _
" /// </summary>" & @CRLF & _
" public void SaveChanges()" & @CRLF & _
" {" & @CRLF & _
" this._appDbContext.SaveChanges();" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// QueryUserCoupons " & @CRLF & _
" /// </summary>" & @CRLF & _
" /// <returns>UserCoupons</returns>" & @CRLF & _
" public IQueryable<user_coupon> QueryUserCoupons()" & @CRLF & _
" {" & @CRLF & _
" return this._appDbContext.user_coupon;" & @CRLF & _
" }" & @CRLF & _
"" & @CRLF & _
" /// <summary>" & @CRLF & _
" /// QueryPubContents " & @CRLF & _
" /// </summary>" & @CRLF & _
" /// <returns>PubContents</returns>" & @CRLF & _
" public IQueryable<pub_content> QueryPubContents()" & @CRLF & _
" {" & @CRLF & _
" return this._appDbContext.pub_content;" & @CRLF & _
" }" & @CRLF & _
" }" & @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