jerome
jerome

Reputation: 4987

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.

Upvotes: 3

Views: 4018

Answers (1)

GilZ
GilZ

Reputation: 6477

Search for:

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

Replace with:

$1: $2;

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

Upvotes: 10

Related Questions