当前位置: 代码迷 >> 综合 >> EditPlus 正则表达式 实战_7
  详细解决方案

EditPlus 正则表达式 实战_7

热度:33   发布时间:2023-12-22 09:25:04.0

这里写图片描述

PLsql中的字段转化为实体类,没用EF工具.
手动转将名称和类型俩列拷贝出来.

fbkh    char(20)
jiuzhenjllsh    varchar2(32)
jianchadwdm varchar2(22)
jianchadwmc varchar2(100)
jianyanbgdh varchar2(200)
menzhenzybz varchar2(1)
jiajilx varchar2(1)
jiuzhenzzddm    varchar2(32)
jiuzhenzzdmc    varchar2(100)
jiuzhenczddm    varchar2(100)
jiuzhenczdmc    varchar2(300)
shenqingksdm    varchar2(32)
shenqingksmc    varchar2(64)
jiuzhenbq   varchar2(20)
jiuzhench   varchar2(20)
shenqingysgh    varchar2(32)
shenqingysxm    varchar2(64)
jianyansqrq date
jianyancjrq date
biaobenh    varchar2(50)
biaobendm   varchar2(32)
biaobenmc   varchar2(200)
baogaoysgh  varchar2(32)
baogaoysxm  varchar2(64)
jianyanbgrq date
shenheysgh  varchar2(32)
shenheysxm  varchar2(64)
baogaoshrq  date
baogaodyrq  date
jianyanbgbz varchar2(1000)
baogaodlbdm varchar2(4)
baogaodlbmc varchar2(100)
jianyanmd   varchar2(4000)
shenhezt    varchar2(1)
jianyanksdm varchar2(32)
jianyanksmc varchar2(100)
tiaoxingm   varchar2(50)
shujuscsj   date
gengxinsj   date
huodongzy   varchar2(300)

要编写成如下格式:

string jiuzhenjllsh = null;
DateTime? baogaodyrq  = null;

fbkh    char(20)
string jiuzhenjllsh = null;
string jianchadwdm = null;
string jianchadwmc = null;
string jianyanbgdh = null;
string menzhenzybz = null;
string jiajilx = null;
string jiuzhenzzddm = null;
string jiuzhenzzdmc = null;
string jiuzhenczddm = null;
string jiuzhenczdmc = null;
string shenqingksdm = null;
string shenqingksmc = null;
string jiuzhenbq = null;
string jiuzhench = null;
string shenqingysgh = null;
string shenqingysxm = null;
jianyansqrq date
jianyancjrq date
string biaobenh = null;
string biaobendm = null;
string biaobenmc = null;
string baogaoysgh = null;
string baogaoysxm = null;
jianyanbgrq date
string shenheysgh = null;
string shenheysxm = null;
baogaoshrq  date
baogaodyrq  date
string jianyanbgbz = null;
string baogaodlbdm = null;
string baogaodlbmc = null;
string jianyanmd = null;
string shenhezt = null;
string jianyanksdm = null;
string jianyanksmc = null;
string tiaoxingm = null;
shujuscsj   date
gengxinsj   date
string huodongzy = null;

查找项输入: ([a-z][a-z])\svarchar2[(][0-9][)]
替换项输入: string \1 = null;

语义分析:
()分组 代表 \1
[a-z]开头
[a-z],结尾
. 点 匹配除“\r\n”之外的任何单个字符。要匹配包括“\r\n”在内的任何字符,请使用像“[\s\S]”的模式。
* 匹配前面的子表达式任意次。例如,zo*能匹配“z”,也能匹配“zo”以及“zoo”。
\s 代表空格

字母[a-z]开头,后面带空格,之后的格式是”varchar2”(中带数字)
替换为格式是 string (分组1即为 /s空格前面的那部分) = null;


fbkh    char(20)
string jiuzhenjllsh = null;
string jianchadwdm = null;
string jianchadwmc = null;
string jianyanbgdh = null;
string menzhenzybz = null;
string jiajilx = null;
string jiuzhenzzddm = null;
string jiuzhenzzdmc = null;
string jiuzhenczddm = null;
string jiuzhenczdmc = null;
string shenqingksdm = null;
string shenqingksmc = null;
string jiuzhenbq = null;
string jiuzhench = null;
string shenqingysgh = null;
string shenqingysxm = null;
DateTime? jianyansqrq = null;
DateTime? jianyancjrq = null;
string biaobenh = null;
string biaobendm = null;
string biaobenmc = null;
string baogaoysgh = null;
string baogaoysxm = null;
DateTime? jianyanbgrq = null;
string shenheysgh = null;
string shenheysxm = null;
DateTime? baogaoshrq = null;
DateTime? baogaodyrq = null;
string jianyanbgbz = null;
string baogaodlbdm = null;
string baogaodlbmc = null;
string jianyanmd = null;
string shenhezt = null;
string jianyanksdm = null;
string jianyanksmc = null;
string tiaoxingm = null;
DateTime? shujuscsj = null;
DateTime? gengxinsj = null;
string huodongzy = null;

查找项输入: ([a-z]*[a-z])\sdate
替换项输入: DateTime\? \1 = null;

if (ds.Tables[2].Columns.Contains("fbkh")) { fbkh = ds.Tables[2].Rows[0]["fbkh"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenjllsh")) { jiuzhenjllsh = ds.Tables[2].Rows[0]["jiuzhenjllsh"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianchadwdm")) { jianchadwdm = ds.Tables[2].Rows[0]["jianchadwdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianchadwmc")) { jianchadwmc = ds.Tables[2].Rows[0]["jianchadwmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanbgdh")) { jianyanbgdh = ds.Tables[2].Rows[0]["jianyanbgdh"].ToString(); }
if (ds.Tables[2].Columns.Contains("menzhenzybz")) { menzhenzybz = ds.Tables[2].Rows[0]["menzhenzybz"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiajilx")) { jiajilx = ds.Tables[2].Rows[0]["jiajilx"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenzzddm")) { jiuzhenzzddm = ds.Tables[2].Rows[0]["jiuzhenzzddm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenzzdmc")) { jiuzhenzzdmc = ds.Tables[2].Rows[0]["jiuzhenzzdmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenczddm")) { jiuzhenczddm = ds.Tables[2].Rows[0]["jiuzhenczddm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenczdmc")) { jiuzhenczdmc = ds.Tables[2].Rows[0]["jiuzhenczdmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingksdm")) { shenqingksdm = ds.Tables[2].Rows[0]["shenqingksdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingksmc")) { shenqingksmc = ds.Tables[2].Rows[0]["shenqingksmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenbq")) { jiuzhenbq = ds.Tables[2].Rows[0]["jiuzhenbq"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhench")) { jiuzhench = ds.Tables[2].Rows[0]["jiuzhench"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingysgh")) { shenqingysgh = ds.Tables[2].Rows[0]["shenqingysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingysxm")) { shenqingysxm = ds.Tables[2].Rows[0]["shenqingysxm"].ToString(); }
DateTime? jianyansqrq = null;
DateTime? jianyancjrq = null;
if (ds.Tables[2].Columns.Contains("biaobenh")) { biaobenh = ds.Tables[2].Rows[0]["biaobenh"].ToString(); }
if (ds.Tables[2].Columns.Contains("biaobendm")) { biaobendm = ds.Tables[2].Rows[0]["biaobendm"].ToString(); }
if (ds.Tables[2].Columns.Contains("biaobenmc")) { biaobenmc = ds.Tables[2].Rows[0]["biaobenmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaoysgh")) { baogaoysgh = ds.Tables[2].Rows[0]["baogaoysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaoysxm")) { baogaoysxm = ds.Tables[2].Rows[0]["baogaoysxm"].ToString(); }
DateTime? jianyanbgrq = null;
if (ds.Tables[2].Columns.Contains("shenheysgh")) { shenheysgh = ds.Tables[2].Rows[0]["shenheysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenheysxm")) { shenheysxm = ds.Tables[2].Rows[0]["shenheysxm"].ToString(); }
DateTime? baogaoshrq = null;
DateTime? baogaodyrq = null;
if (ds.Tables[2].Columns.Contains("jianyanbgbz")) { jianyanbgbz = ds.Tables[2].Rows[0]["jianyanbgbz"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaodlbdm")) { baogaodlbdm = ds.Tables[2].Rows[0]["baogaodlbdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaodlbmc")) { baogaodlbmc = ds.Tables[2].Rows[0]["baogaodlbmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanmd")) { jianyanmd = ds.Tables[2].Rows[0]["jianyanmd"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenhezt")) { shenhezt = ds.Tables[2].Rows[0]["shenhezt"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanksdm")) { jianyanksdm = ds.Tables[2].Rows[0]["jianyanksdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanksmc")) { jianyanksmc = ds.Tables[2].Rows[0]["jianyanksmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("tiaoxingm")) { tiaoxingm = ds.Tables[2].Rows[0]["tiaoxingm"].ToString(); }
DateTime? shujuscsj = null;
DateTime? gengxinsj = null;
if (ds.Tables[2].Columns.Contains("huodongzy")) { huodongzy = ds.Tables[2].Rows[0]["huodongzy"].ToString(); }

查找项输入: string\s([a-z]*[a-z])\s=\snull;
替换项输入: if (ds.Tables[2].Columns.Contains(“\1”)) { \1 = ds.Tables[2].Rows[0][“\1”].ToString(); }

if (ds.Tables[2].Columns.Contains("fbkh")) { fbkh = ds.Tables[2].Rows[0]["fbkh"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenjllsh")) { jiuzhenjllsh = ds.Tables[2].Rows[0]["jiuzhenjllsh"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianchadwdm")) { jianchadwdm = ds.Tables[2].Rows[0]["jianchadwdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianchadwmc")) { jianchadwmc = ds.Tables[2].Rows[0]["jianchadwmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanbgdh")) { jianyanbgdh = ds.Tables[2].Rows[0]["jianyanbgdh"].ToString(); }
if (ds.Tables[2].Columns.Contains("menzhenzybz")) { menzhenzybz = ds.Tables[2].Rows[0]["menzhenzybz"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiajilx")) { jiajilx = ds.Tables[2].Rows[0]["jiajilx"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenzzddm")) { jiuzhenzzddm = ds.Tables[2].Rows[0]["jiuzhenzzddm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenzzdmc")) { jiuzhenzzdmc = ds.Tables[2].Rows[0]["jiuzhenzzdmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenczddm")) { jiuzhenczddm = ds.Tables[2].Rows[0]["jiuzhenczddm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenczdmc")) { jiuzhenczdmc = ds.Tables[2].Rows[0]["jiuzhenczdmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingksdm")) { shenqingksdm = ds.Tables[2].Rows[0]["shenqingksdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingksmc")) { shenqingksmc = ds.Tables[2].Rows[0]["shenqingksmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhenbq")) { jiuzhenbq = ds.Tables[2].Rows[0]["jiuzhenbq"].ToString(); }
if (ds.Tables[2].Columns.Contains("jiuzhench")) { jiuzhench = ds.Tables[2].Rows[0]["jiuzhench"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingysgh")) { shenqingysgh = ds.Tables[2].Rows[0]["shenqingysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenqingysxm")) { shenqingysxm = ds.Tables[2].Rows[0]["shenqingysxm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyansqrq")) { jianyansqrq = Convert.ToDateTime(ds.Tables[2].Rows[0]["jianyansqrq"]); }
if (ds.Tables[2].Columns.Contains("jianyancjrq")) { jianyancjrq = Convert.ToDateTime(ds.Tables[2].Rows[0]["jianyancjrq"]); }
if (ds.Tables[2].Columns.Contains("biaobenh")) { biaobenh = ds.Tables[2].Rows[0]["biaobenh"].ToString(); }
if (ds.Tables[2].Columns.Contains("biaobendm")) { biaobendm = ds.Tables[2].Rows[0]["biaobendm"].ToString(); }
if (ds.Tables[2].Columns.Contains("biaobenmc")) { biaobenmc = ds.Tables[2].Rows[0]["biaobenmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaoysgh")) { baogaoysgh = ds.Tables[2].Rows[0]["baogaoysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaoysxm")) { baogaoysxm = ds.Tables[2].Rows[0]["baogaoysxm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanbgrq")) { jianyanbgrq = Convert.ToDateTime(ds.Tables[2].Rows[0]["jianyanbgrq"]); }
if (ds.Tables[2].Columns.Contains("shenheysgh")) { shenheysgh = ds.Tables[2].Rows[0]["shenheysgh"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenheysxm")) { shenheysxm = ds.Tables[2].Rows[0]["shenheysxm"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaoshrq")) { baogaoshrq = Convert.ToDateTime(ds.Tables[2].Rows[0]["baogaoshrq"]); }
if (ds.Tables[2].Columns.Contains("baogaodyrq")) { baogaodyrq = Convert.ToDateTime(ds.Tables[2].Rows[0]["baogaodyrq"]); }
if (ds.Tables[2].Columns.Contains("jianyanbgbz")) { jianyanbgbz = ds.Tables[2].Rows[0]["jianyanbgbz"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaodlbdm")) { baogaodlbdm = ds.Tables[2].Rows[0]["baogaodlbdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("baogaodlbmc")) { baogaodlbmc = ds.Tables[2].Rows[0]["baogaodlbmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanmd")) { jianyanmd = ds.Tables[2].Rows[0]["jianyanmd"].ToString(); }
if (ds.Tables[2].Columns.Contains("shenhezt")) { shenhezt = ds.Tables[2].Rows[0]["shenhezt"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanksdm")) { jianyanksdm = ds.Tables[2].Rows[0]["jianyanksdm"].ToString(); }
if (ds.Tables[2].Columns.Contains("jianyanksmc")) { jianyanksmc = ds.Tables[2].Rows[0]["jianyanksmc"].ToString(); }
if (ds.Tables[2].Columns.Contains("tiaoxingm")) { tiaoxingm = ds.Tables[2].Rows[0]["tiaoxingm"].ToString(); }
if (ds.Tables[2].Columns.Contains("shujuscsj")) { shujuscsj = Convert.ToDateTime(ds.Tables[2].Rows[0]["shujuscsj"]); }
if (ds.Tables[2].Columns.Contains("gengxinsj")) { gengxinsj = Convert.ToDateTime(ds.Tables[2].Rows[0]["gengxinsj"]); }
if (ds.Tables[2].Columns.Contains("huodongzy")) { huodongzy = ds.Tables[2].Rows[0]["huodongzy"].ToString(); }

查找项输入:DateTime\?\s([a-z]*[a-z])\s=\snull;
替换项输入: if (ds.Tables[2].Columns.Contains(“\1”)) { \1 = Convert.ToDateTime(ds.Tables[2].Rows[0][“\1”]); }