正则匹配不在()里面的逗号
做一个生成列头的工具,要获取输入的sql语句的字段名,sql语句如下:
Select t1.PA_PURCHASE_ID,t1.PURCHASE_D_CODE,t1.PART_NO,t1.PART_NAME,
t1.PURCHASE_UINT,,dbo.F_GETBASEVALUE('PART_TYPE', t1.PART_TYPE,1) PART_TYPE
,t1.PURCHASE_DEPT ,convert(varchar(10),t1.PART_ARR_DATE,120) PART_ARR_DATE
,t1.USE_DESC ,t1.REMARK
,dbo.F_NameLongToShort(dbo.GetEmpName(t1.APPLY_PERSON)) APPLY_PERSON,t1.PLAN_APPLY_CODE,t1.PURCHASE_ASS
,t1.IN_STORAGE_NUM From T_ST_DB_PA_PURCHASE t1 Where t1.PLAN_APPLY_CODE='#ID#
利用正则表达式匹配逗号,是否在()里面,如果在(,,,)里面则跳过分割,如果不在括号里面,(),则分割。
------解决方案--------------------(?<![\(\)].*),
------解决方案--------------------
C# code
(?<!\([^()]*),(?![^()]*\))