EditPlus 正则表达式 实战(3)

相关阅读:

EditPlus中的正则表达式 实战(1)

EditPlus中的正则表达式 实战(2)

EditPlus 正则表达式 实战(3)

EditPlus中的正则表达式 实战(4)

EditPlus中的正则表达式实战(5)

EditPlus中的正则表达式实战(6)

#region隐藏字段成员 
///<summary> 
///复查编号 
///</summary> 
///[NotNullValidator] 
stringFUCHABH=null; 
///<summary> 
///妇保卡号 
///</summary> 
///[NotNullValidator] 
stringFBKH=null; 
///<summary> 
///妇女编号 
///</summary> 
stringFUNVID=null; 
///<summary> 
///尿蛋白评价 
///</summary> 
///[NotNullValidator] 
stringNIAODANBPJ=null; 
///<summary> 
/// 
///</summary> 
stringID=null; 
///<summary> 
///其他胎位 
///</summary> 
stringQITATAIWEI=null; 
///<summary> 
///其他胎先露 
///</summary> 
stringQITATAIXIANLU=null; 
///<summary> 
///血糖评价 
///</summary> 
stringXUETANGPJ=null; 
///<summary> 
///用户编号 
///</summary> 
if(ds.Tables[2].Columns.Contains("YONGHUBH")){YONGHUBH = Convert.ToInt32(ds.Tables[2].Rows[0]["YONGHUBH"]);} 
///<summary> 
///贫血评价 
///</summary> 
stringPINXUEPJ=null; 
///<summary> 
/// 
///</summary> 
///[NotNullValidator] 
stringZHUJIANZ=null; 
///<summary> 
///胎心率(次/分钟) 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAIXINLV=null; 
///<summary> 
///胎方位 
///</summary> 
stringTAIWEI=null; 
///<summary> 
///血糖类型 
///</summary> 
stringXUETANGLX=null; 
///<summary> 
///B超检查 
///</summary> 
if(ds.Tables[2].Columns.Contains("BCHAJC=null; 
///<summary> 
///检查单位编号 
///</summary> 
stringJIANCHADWBH=null; 
///<summary> 
///服务机构编号 
///</summary> 
stringFUWUJGBH=null; 
///<summary> 
///录入人 
///</summary> 
stringTIANBIAOR=null; 
///<summary> 
///录入日期 
///</summary> 
DateTime?TIANBIAORQ=null; 
#endregion 
#region成员 
///<summary> 
///检查日期 
///</summary> 
DateTime?JIANCHARQ=null; 
///<summary> 
/// 
///</summary> 
stringGAOWEIBM=null; 
///<summary> 
///检查孕周 
///</summary> 
if(ds.Tables[2].Columns.Contains("JIANCHAYZ=null; 
///<summary> 
///有无异常 
///</summary> 
///[NotNullValidator] 
stringYOUWUYC=null; 
///<summary> 
///收缩压 
///</summary> 
if(ds.Tables[2].Columns.Contains("SHOUSUOY=null; 
///<summary> 
///体重(千克) 
///</summary> 
float?TIZHONG=null; 
///<summary> 
///有无症状 
///</summary> 
///[NotNullValidator] 
stringYOUWUZZ=null; 
///<summary> 
///其他辅助检查项目 
///</summary> 
///[NotNullValidator] 
stringFUZHUJC=null; 
///<summary> 
///病情情况 
///</summary> 
stringZHENDUAN=null; 
///<summary> 
///孕情情况 
///</summary> 
stringYUNQINGQK=null; 
///<summary> 
///宫高(厘米) 
///</summary> 
float?GONGDIGD=null; 
///<summary> 
///腹围(厘米) 
///</summary> 
float?FUWEI=null; 
///<summary> 
///胎数类型 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAISHULX=null; 
///<summary> 
///胎数 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAISHU=null; 
///<summary> 
///胎先露 
///</summary> 
stringTAIXIANLU=null; 
///<summary> 
///衔接(胎头和骨盆是否衔接) 
///</summary> 
if(ds.Tables[2].Columns.Contains("XIANJIE=null; 
///<summary> 
///血糖(mmol/L) 
///</summary> 
float?XUETANG=null; 
///<summary> 
///浮肿 
///</summary> 
stringFUZHONG=null; 
///<summary> 
///尿蛋白(mg/24h) 
///</summary> 
float?NIAODB=null; 
///<summary> 
///其他胎心率 
///</summary> 
stringQITATAIXINLV=null; 
///<summary> 
///血红蛋白(g/L) 
///</summary> 
float?XUEHONGDB=null; 
///<summary> 
///是否外出检查 
///</summary> 
stringSFWCJC=null; 
///<summary> 
///B超检查 
///</summary> 
stringJIANCHAJG=null; 
///<summary> 
///外出检查医院 
///</summary> 
stringWCJCYY=null; 
///<summary> 
///B超异常情况 
///</summary> 
stringJIANCHAJGMS=null; 
///<summary> 
///外出检查结果 
///</summary> 
stringWCJCJG=null; 
///<summary> 
///外出检查结果描述 
///</summary> 
stringWCJCJGMS=null; 
///<summary> 
///高危评定 
///</summary> 
stringGAOWEIPD=null; 
///<summary> 
///高危因素 
///</summary> 
stringGAOWEIYS=null; 
///<summary> 
///症状 
///</summary> 
stringZHENGZHUANG=null; 
///<summary> 
///异常情况 
///</summary> 
stringYICHANGQK=null; 
///<summary> 
///处理及指导 
///</summary> 
stringCHULIZD=null; 
///<summary> 
///预约日期 
///</summary> 
DateTime?YUYUERQ=null; 
///<summary> 
///检查单位 
///</summary> 
stringJIANCHADW=null; 
///<summary> 
///检查医生 
///</summary> 
stringJIANCHAYS=null; 
///<summary> 
///检查孕天 
///</summary> 
if(ds.Tables[2].Columns.Contains("JIANCHAYT=null; 
///<summary> 
///舒张压 
///</summary> 
if(ds.Tables[2].Columns.Contains("SHUZHANGY=null; 
///<summary> 
///高危级别 
///</summary> 
stringGAOWEIDJ=null; 
///<summary> 
///高危评分值 
///</summary> 
if(ds.Tables[2].Columns.Contains("GAOWEIPFVALUE=null; 
///<summary> 
///NST 
///</summary> 
float?NST=null; 
///<summary> 
///有无转诊 
///</summary> 
stringYOUWUZHUANZHEN=null; 
///<summary> 
///转诊原因 
///</summary> 
stringZHUANZHENYY=null; 
///<summary> 
///转诊机构编号 
///</summary> 
stringZHUANZHENJJBH=null; 
///<summary> 
///转诊机构 
///</summary> 
stringZHUANZHENJJ=null; 
///<summary> 
///转诊科室 
///</summary> 
stringZHUANZHENKS=null; 
///<summary> 
///其他指导详述 
///</summary> 
stringQITAZHIDAOSX=null; 
///<summary> 
///指导名称 
///</summary> 
stringCHULIZDMC=null; 
#endregion 
#region其他字段 
///<summary> 
///其他高危因素 
///</summary> 
stringQTGAOWEIYS=null; 
///<summary> 
///血糖1(mmol/L) 
///</summary> 
float?XUETZ=null; 
///<summary> 
///血糖2(mmol/L) 
///</summary> 
float?XTANGZ=null; 
///<summary> 
///孕妇学校 
///</summary> 
stringYUNFUXX=null; 
///<summary> 
///NST类型 
///</summary> 
stringNSTLX=null; 
///<summary> 
///关联随访辅助检查用 
///</summary> 
stringFUZHUJCNUM=null; 
///<summary> 
///既往未纠正高危因素 
///</summary> 
stringWEIJIUZGW=null; 
#endregion

如上代码要编写成如下格式:

if(ds.Tables[2].Columns.Contains("YONGHUBH")){YONGHUBH = Convert.ToInt32(ds.Tables[2].Rows[0]["YONGHUBH"]);} 
#region隐藏字段成员 
///<summary> 
///复查编号 
///</summary> 
///[NotNullValidator] 
stringFUCHABH=null; 
///<summary> 
///妇保卡号 
///</summary> 
///[NotNullValidator] 
stringFBKH=null; 
///<summary> 
///妇女编号 
///</summary> 
stringFUNVID=null; 
///<summary> 
///尿蛋白评价 
///</summary> 
///[NotNullValidator] 
stringNIAODANBPJ=null; 
///<summary> 
/// 
///</summary> 
stringID=null; 
///<summary> 
///其他胎位 
///</summary> 
stringQITATAIWEI=null; 
///<summary> 
///其他胎先露 
///</summary> 
stringQITATAIXIANLU=null; 
///<summary> 
///血糖评价 
///</summary> 
stringXUETANGPJ=null; 
///<summary> 
///用户编号 
///</summary> 
if(ds.Tables[2].Columns.Contains("YONGHUBH")){YONGHUBH = Convert.ToInt32(ds.Tables[2].Rows[0]["YONGHUBH"]);} 
///<summary> 
///贫血评价 
///</summary> 
stringPINXUEPJ=null; 
///<summary> 
/// 
///</summary> 
///[NotNullValidator] 
stringZHUJIANZ=null; 
///<summary> 
///胎心率(次/分钟) 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAIXINLV")){TAIXINLV = Convert.ToInt32(ds.Tables[2].Rows[0]["TAIXINLV"]);} 
///<summary> 
///胎方位 
///</summary> 
stringTAIWEI=null; 
///<summary> 
///血糖类型 
///</summary> 
stringXUETANGLX=null; 
///<summary> 
///B超检查 
///</summary> 
if(ds.Tables[2].Columns.Contains("BCHAJC")){BCHAJC = Convert.ToInt32(ds.Tables[2].Rows[0]["BCHAJC"]);} 
///<summary> 
///检查单位编号 
///</summary> 
stringJIANCHADWBH=null; 
///<summary> 
///服务机构编号 
///</summary> 
stringFUWUJGBH=null; 
///<summary> 
///录入人 
///</summary> 
stringTIANBIAOR=null; 
///<summary> 
///录入日期 
///</summary> 
DateTime?TIANBIAORQ=null; 
#endregion 
#region成员 
///<summary> 
///检查日期 
///</summary> 
DateTime?JIANCHARQ=null; 
///<summary> 
/// 
///</summary> 
stringGAOWEIBM=null; 
///<summary> 
///检查孕周 
///</summary> 
if(ds.Tables[2].Columns.Contains("JIANCHAYZ")){JIANCHAYZ = Convert.ToInt32(ds.Tables[2].Rows[0]["JIANCHAYZ"]);} 
///<summary> 
///有无异常 
///</summary> 
///[NotNullValidator] 
stringYOUWUYC=null; 
///<summary> 
///收缩压 
///</summary> 
if(ds.Tables[2].Columns.Contains("SHOUSUOY")){SHOUSUOY = Convert.ToInt32(ds.Tables[2].Rows[0]["SHOUSUOY"]);} 
///<summary> 
///体重(千克) 
///</summary> 
float?TIZHONG=null; 
///<summary> 
///有无症状 
///</summary> 
///[NotNullValidator] 
stringYOUWUZZ=null; 
///<summary> 
///其他辅助检查项目 
///</summary> 
///[NotNullValidator] 
stringFUZHUJC=null; 
///<summary> 
///病情情况 
///</summary> 
stringZHENDUAN=null; 
///<summary> 
///孕情情况 
///</summary> 
stringYUNQINGQK=null; 
///<summary> 
///宫高(厘米) 
///</summary> 
float?GONGDIGD=null; 
///<summary> 
///腹围(厘米) 
///</summary> 
float?FUWEI=null; 
///<summary> 
///胎数类型 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAISHULX")){TAISHULX = Convert.ToInt32(ds.Tables[2].Rows[0]["TAISHULX"]);} 
///<summary> 
///胎数 
///</summary> 
if(ds.Tables[2].Columns.Contains("TAISHU")){TAISHU = Convert.ToInt32(ds.Tables[2].Rows[0]["TAISHU"]);} 
///<summary> 
///胎先露 
///</summary> 
stringTAIXIANLU=null; 
///<summary> 
///衔接(胎头和骨盆是否衔接) 
///</summary> 
if(ds.Tables[2].Columns.Contains("XIANJIE")){XIANJIE = Convert.ToInt32(ds.Tables[2].Rows[0]["XIANJIE"]);} 
///<summary> 
///血糖(mmol/L) 
///</summary> 
float?XUETANG=null; 
///<summary> 
///浮肿 
///</summary> 
stringFUZHONG=null; 
///<summary> 
///尿蛋白(mg/24h) 
///</summary> 
float?NIAODB=null; 
///<summary> 
///其他胎心率 
///</summary> 
stringQITATAIXINLV=null; 
///<summary> 
///血红蛋白(g/L) 
///</summary> 
float?XUEHONGDB=null; 
///<summary> 
///是否外出检查 
///</summary> 
stringSFWCJC=null; 
///<summary> 
///B超检查 
///</summary> 
stringJIANCHAJG=null; 
///<summary> 
///外出检查医院 
///</summary> 
stringWCJCYY=null; 
///<summary> 
///B超异常情况 
///</summary> 
stringJIANCHAJGMS=null; 
///<summary> 
///外出检查结果 
///</summary> 
stringWCJCJG=null; 
///<summary> 
///外出检查结果描述 
///</summary> 
stringWCJCJGMS=null; 
///<summary> 
///高危评定 
///</summary> 
stringGAOWEIPD=null; 
///<summary> 
///高危因素 
///</summary> 
stringGAOWEIYS=null; 
///<summary> 
///症状 
///</summary> 
stringZHENGZHUANG=null; 
///<summary> 
///异常情况 
///</summary> 
stringYICHANGQK=null; 
///<summary> 
///处理及指导 
///</summary> 
stringCHULIZD=null; 
///<summary> 
///预约日期 
///</summary> 
DateTime?YUYUERQ=null; 
///<summary> 
///检查单位 
///</summary> 
stringJIANCHADW=null; 
///<summary> 
///检查医生 
///</summary> 
stringJIANCHAYS=null; 
///<summary> 
///检查孕天 
///</summary> 
if(ds.Tables[2].Columns.Contains("JIANCHAYT")){JIANCHAYT = Convert.ToInt32(ds.Tables[2].Rows[0]["JIANCHAYT"]);} 
///<summary> 
///舒张压 
///</summary> 
if(ds.Tables[2].Columns.Contains("SHUZHANGY")){SHUZHANGY = Convert.ToInt32(ds.Tables[2].Rows[0]["SHUZHANGY"]);} 
///<summary> 
///高危级别 
///</summary> 
stringGAOWEIDJ=null; 
///<summary> 
///高危评分值 
///</summary> 
if(ds.Tables[2].Columns.Contains("GAOWEIPFVALUE")){GAOWEIPFVALUE = Convert.ToInt32(ds.Tables[2].Rows[0]["GAOWEIPFVALUE"]);} 
///<summary> 
///NST 
///</summary> 
float?NST=null; 
///<summary> 
///有无转诊 
///</summary> 
stringYOUWUZHUANZHEN=null; 
///<summary> 
///转诊原因 
///</summary> 
stringZHUANZHENYY=null; 
///<summary> 
///转诊机构编号 
///</summary> 
stringZHUANZHENJJBH=null; 
///<summary> 
///转诊机构 
///</summary> 
stringZHUANZHENJJ=null; 
///<summary> 
///转诊科室 
///</summary> 
stringZHUANZHENKS=null; 
///<summary> 
///其他指导详述 
///</summary> 
stringQITAZHIDAOSX=null; 
///<summary> 
///指导名称 
///</summary> 
stringCHULIZDMC=null; 
#endregion 
#region其他字段 
///<summary> 
///其他高危因素 
///</summary> 
stringQTGAOWEIYS=null; 
///<summary> 
///血糖1(mmol/L) 
///</summary> 
float?XUETZ=null; 
///<summary> 
///血糖2(mmol/L) 
///</summary> 
float?XTANGZ=null; 
///<summary> 
///孕妇学校 
///</summary> 
stringYUNFUXX=null; 
///<summary> 
///NST类型 
///</summary> 
stringNSTLX=null; 
///<summary> 
///关联随访辅助检查用 
///</summary> 
stringFUZHUJCNUM=null; 
///<summary> 
///既往未纠正高危因素 
///</summary> 
stringWEIJIUZGW=null; 
#endregion

EditPlus 正则表达式 实战(3)

先手动整理下格式去掉空格

然后替换

查找项输入: (\bif[\(|\[|\]|\.|A-Z|a-z|0-9]{0,}[A-Z|a-z|\(|\"])([A-Za-z0-9_]*)(=null;)

替换项输入:     \1\2")){\2 = Convert.ToInt32(ds.Tables[2].Rows[0]["\2"]);}

语义分析: 先去掉括号"()"  \bif[\(|\[|\]|\.|A-Z|a-z|0-9]{0,}[A-Z|a-z|\(|\"][A-Za-z0-9_]*=null;

匹配一个单词边界,也就是指单词和空格间的位置(\b)if;之后紧跟[\(|\[|\]|\.|A-Z|a-z|0-9] 包含 ( [ ] ) . 字母A-Z a-z 0-9 内容 ,结束也包含 [A-Z|a-z|\(|\"][A-Za-z0-9_] 符合此要求的段落

最后包含=null; 的段落

相关推荐