[英]Using regex to find/replace in PhpStorm
I am working to refactor a dependency on Compass mixins to simply use CSS rules which will be vendor prefixed by autoprefixer as a post process. 我正在努力重构对Compass mixins的依赖,以简单地使用CSS规则,该规则将由autoprefixer作为后期处理以供应商为前缀。
So I am going through a large code-base with the need to replace strings such as: 所以我要经历一个大型代码库,需要替换字符串,例如:
@include border-radius($big-radius);
With something like: 有类似的东西:
border-radius: $big-radius;
The IDE I am using is PhpStorm, which provides a find/replace regex feature. 我使用的IDE是PhpStorm,它提供了查找/替换正则表达式功能。 What should the regex for the case above look like?
上述案例的正则表达式应该是什么样的? I'm sure I can adapt that for many other purposes as I continue working on this.
我确信我可以将其用于许多其他目的,因为我继续努力。
Search for: 搜索:
@include (.*)\((.*)\);
Replace with: 用。。。来代替:
$1: $2;
The (.*)
parts creates groups. (.*)
部分创建组。 the $<number>
reference those groups. $<number>
引用这些组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.