替换栏中用$1即可表示搜索栏中正则表达式的匹配结果
例:
`
if (creep.memory.role == 'long_pionner')
if (creep.memory.role == 'long_carrier')
if (creep.memory.role == 'long_harvester')
`
替换为
`
if (startWith(creep.memory.role, 'long_pionner'))
if (startWith(creep.memory.role, 'long_carrier'))
if (startWith(creep.memory.role, 'long_harvester'))
`
搜索栏中输入creep.memory.role == '(.*)'
替换栏中输入startWith(creep.memory.role, '$1')
即可达到效果
注:VSCODE搜索栏中启用正则表达式时无需在两边输入/ /
Comments | NOTHING