例如,需要將以下文字:
include ':app'
include ':lib'
替換為
include(":app")
include(":lib")
則需使用組捕獲(https://www.jetbrains.com/help/idea/tutorial-finding-and-replacing-text-using-regular-expressions.html#capture_groups_and_backreference);即使用括號(hào)將需要保留的字符串包裹,并在替換字符串中通過(guò) $1 引用。
如上例中,查找內(nèi)容填寫(xiě) include ('.*'),替換字符串填寫(xiě) include($1) 即可。

image.png

image.png