我需要找到找到並使用正則表達式
sessionOpen(0, (int *)(&SessionId));
和更換相同如下替換字符串,
sessionOpen(
\#if USE_MULTIPLE_DB
0,
\#endif
(int *)(&SessionId));
我怎樣才能做到這一點使用正則表達式搜索和替換的方法? ??
我需要找到找到並使用正則表達式
sessionOpen(0, (int *)(&SessionId));
和更換相同如下替換字符串,
sessionOpen(
\#if USE_MULTIPLE_DB
0,
\#endif
(int *)(&SessionId));
我怎樣才能做到這一點使用正則表達式搜索和替換的方法? ??
與sessionOpen(\n#if USE_MULTIPLE_DB $1, #endif\n(int *)(&SessionId))
(我假設你想捕捉的零0
)
謝謝你的回答,但我需要在'#if'和'#endif'bt'\ n'不工作後添加一個新行? –
當我試圖以你告訴的方式替換這個字符串時,我得到了一個錯誤如下,在eclipse中「索引83396附近不兼容的行分隔符」請幫我解決這個問題。 –
這將幫助你更換sessionOpen\((0), \(int \*\)\(&SessionId\)\);
:http://gaoithe.blogspot.com/2009/11/eclipse-regexp-findreplace-error.html
Make sure everything is dos2unix converted if touched by something which converts it the other way. In eclipse you can select File -> Convert line delimiters to ...
WARNING: Don't mess with file encoding unless you know what you'er doing!
In eclipse these other settings are relevant:
Right-click on Project -> Properties
Resource -> Text File Encoding
Might be best to leave this (Inherited from container Cp1252 for windows)
Resource -> New Text File Line Delimiter
Change to "unix"
Windows -> Preferences
General -> Editors -> Text Editors
Select "Insert spaces for tabs"
General -> Content types -> Text -> Tcl Content Type
Set default enccoding (leave it alone is probably best policy!)
請訪問http://計算器。 com/questions/6619851/remove-empty-lines-in-eclipse-code-editior-by-find-replace-ctrlf尋求可能的幫助。 –