notepad++ - 这是关于 Notepad++ 正则表达式替换
问题描述
我想换
<th scope="col">@translate(Product)</th>
代码行到
<th scope="col">{{trans("file.Product")}}</th>
在 NotePad++ 中,但我不能写出完全正确的正则表达式。请帮帮我。
解决方案
- Ctrl+H
- 找什么:
<th scope="col">\K@translate\((.+?)\)(?=</th>)
- 用。。。来代替:
{{trans("file.$1")}}
- 检查 火柴盒
- 检查 环绕
- CHECK 正则表达式
- Replace all
解释:
<th scope="col"> # literally
\K # forget all we have seen until this position
@translate # literally
\( # openning parenthesis
(.+?) # group 1, 1 or more any character, not greedy
\) # closing parenthesis
(?=</th>) # positive lookahead, make sure we have a closing tag after
截图(之前):
截图(之后):
推荐阅读
- angular - 如果使用 object.value 而不是 object,则角度递归模板列表将变为无限递归
- nspredicate - 具有 2 个值的 NSPredicateRow(例如“介于”)
- go - Go 中的错误处理:何时忽略错误?
- php - 我对 PHPMailer 包有疑问
- java - 在java中传递一个func条件
- doxygen - 非法别名格式“ALIASES”
- swing - IntelliJ插件,复用系统形式
- c# - 将项目升级到目标 .net 框架到 4.7.2,而不升级 nuget 引用
- ruby-on-rails - 设计 gem `const_get':未初始化的常量 Devise::Models::RemoteAuthenticatable (NameError)
- javascript - 将多个 JS 文件添加到 Angular 中?