re = /public ([\w><]+ [\w><]+\(\))\s+{[^}]+}/m
str = 'using System.Linq;
using NineYi.ERPV2.DA.AppDB.Tables;
namespace NineYi.ERPV2.DA.Repositories.DbRepositories
{
/// <summary>
/// AppDbRepository
/// </summary>
public class AppDbRepository : IAppDbRepository
{
/// <summary>
/// AppDbContext
/// </summary>
private AppDbContext _appDbContext;
/// <summary>
/// Initializes a new instance of the <see cref="AppDbRepository" /> class.
/// </summary>
/// <param name="appDbContext">AppDbContext</param>
public AppDbRepository(AppDbContext appDbContext)
{
this._appDbContext = appDbContext;
}
/// <summary>
/// SaveChanges
/// </summary>
public void SaveChanges()
{
this._appDbContext.SaveChanges();
}
/// <summary>
/// QueryUserCoupons
/// </summary>
/// <returns>UserCoupons</returns>
public IQueryable<user_coupon> QueryUserCoupons()
{
return this._appDbContext.user_coupon;
}
/// <summary>
/// QueryPubContents
/// </summary>
/// <returns>PubContents</returns>
public IQueryable<pub_content> QueryPubContents()
{
return this._appDbContext.pub_content;
}
}
}'
subst = '\\1;'
result = str.gsub(re, subst)
# Print the result of the substitution
puts 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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html