相關閱讀:
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
先手動整理下格式去掉空格
然後替換
查找項輸入: (\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; 的段落
以上所述是小編給大家介紹的EditPlus 正則表達式 實戰(3),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對網站的支持!