我试图在多个 yaml 文件中注释掉 Azure DevOps 管道阶段。我尝试使用
在文件中查找
在Notepad++中,但是不成功。
我正在尝试注释掉以下阶段。
- stage: "check_code"
jobs:
- job: "check_code"
pool:
vmImage: 'windows-latest'
steps:
- template: check_code.yml@templates
parameters:
projectName: '$(projectName)'
这就是我想要达到的目标。
# - stage: "check_code"
# jobs:
# - job: "check_code"
# pool:
# vmImage: 'windows-latest'
# steps:
# - template: check_code.yml@templates
# parameters:
# projectName: '$(projectName)'
当我使用记事本++时,我可以复制查找内容搜索框中的行,但无法复制替换为框中注释掉的多行。
关于如何更换它有什么建议吗?
^(?:(- stage: "check_code"\R)|\G(\h*)(?!-stage)(.+\R))
$2# $1$3
. matches newline
说明:
^ # beginning of line
(?: # non capture group
( # group 1
- stage: "check_code" # literally
\R # any kind of linebreak
) # end group 1
| # OR
\G # restart from last match position
(\h*) # group 2, 0 or more horizontal spaces
(?!-stage) # negative lookahead, make sure we haven't -stage after
( # group 3
.+ # 1 or more any character
\R # any kind of linebreak
) # end group 3
) # end group
截图(之前):
截图(之后):