Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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. 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.

like image 681
jerome Avatar asked Dec 05 '25 04:12

jerome


1 Answers

Search for:

@include (.*)\((.*)\);

Replace with:

$1: $2;

The (.*) parts creates groups. the $<number> reference those groups.

like image 155
GilZ Avatar answered Dec 07 '25 16:12

GilZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!