今天經過sql server的forXml 和 openXML處理不數據庫的數據同步須要從sql server中拷貝select 語句到myeclipse中作進一步操做(有的表字段太多了~寫的話容易出錯。。)正則表達式
使用Find : \W*\[([A-Z]*)\]\r\n
Replace : $1 $1, sql
SELECT TOP 1000 [ID]
,[TSBT]
,[TSSJ]
,[TSNR]
,[TSLX]
,[TSQD]
,[TSDQ]
,[TSR]
,[TSRLXFS]
,[SFCXCF]
,[HFNR]
,[HFSJ]
,[BLXS]
,[SSJGID]
,[DCBGGS]
,[NBYJ]
,[CLZT]
,[BJQK]
,[LYLX]
,[FWLX]
,[CLJG]
,[BLJG]
,[DCBGWJM]
,[SJBB]
,[CJSJ]
,[BJSJ]
,[YWXTBSID]
,[JLZT]
,[SJC]數據庫
變成:
SELECT TOP 1000ID ID,TSBT TSBT,TSSJ TSSJ,TSNR TSNR,TSLX TSLX,TSQD TSQD,TSDQ TSDQ,TSR TSR,TSRLXFS TSRLXFS,SFCXCF SFCXCF,HFNR HFNR,HFSJ HFSJ,BLXS BLXS,SSJGID SSJGID,DCBGGS DCBGGS,NBYJ NBYJ,CLZT CLZT,BJQK BJQK,LYLX LYLX,FWLX FWLX,CLJG CLJG,BLJG BLJG,DCBGWJM DCBGWJM,SJBB SJBB,CJSJ CJSJ,BJSJ BJSJ,YWXTBSID YWXTBSID,JLZT JLZT,SJC SJC,express
而後處理下頭尾和分行,在SHIFT+CTRL+F 一個全字段的select 就出來了~~!~~api
--:整理myeclipse中的正則用法 ---less
在光標處在查找輸入框時使用 "ALT+/" 打開提示:內容。。。很長eclipse
^ 行頭spa
略~!~code
$ 行尾orm
在光標處在替換輸入框時使用 "ALT+/" 打開提示:內容和下面這段相似
(在查找/替換對話框時使用F1打開的幫助文檔。。。)
Supported Regular Expressions
When searching for text you can use the regular expressions as defined by the Pattern class.
Additionally, \R can be used to match any form of line delimiter (Unix, Windows, Mac OS 9). Note that \R does not work in character groups ([]).
The replace string allows the following constructs:
$i inserts capturing group i. 插入捕獲分組i 在正則中第一個括號即爲第一個捕獲分組
如:(abc(def)*) 匹配 abcdefdef 時 第一分組爲abcdefdef 第二分組爲def 。。。這裏還涉及到另外一個東西那就是正則表達式老是努力進行最長的匹配;
(abc(def)*)匹配 abcefdef時 第一分組爲abc 第二分組爲def
\i inserts capturing group i (same as $i). 同上
\x quotes character x (unless \x has a special meaning) ..不知道怎麼用
\R inserts the default line delimiter of the document 插入文檔的默認行分隔符
\xhh inserts the hexadecimal character hh 插入的十六進制字符
\uhhhh inserts the Unicode character hhhh 插入的Unicode字符HHHH
\n inserts a newline character (usually, you should use \R instead) 插入一個換行符(一般狀況下,你應該使用\ r代替)
\r inserts a carriage-return character (usually, you should use \R instead) 插入一個回車字符(一般狀況下,你應該使用\ r代替)
\t inserts a tab character 插入一個製表符
\f inserts a form-feed character 插入一個換頁符
\a inserts an alert (beep) character inserts an alert (beep) character
\e inserts an escape character 插入一個轉義字符
\cC inserts a the control character for C 插入一個控制字符C \C retains the casing of the match (all lower case, all upper case, capitalized) 也是不知道什麼用。。。s