例如,需要將以下文字:
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);即使用括號將需要保留的字符串包裹踢星,并在替換字符串中通過 $1
引用馍迄。
如上例中捅儒,查找內(nèi)容填寫 include ('.*')
灰蛙,替換字符串填寫 include($1)
即可圣贸。
image.png
image.png