user2186697
user2186697

Reputation: 69

Mass Regex Replace

I'm trying to tweak a style sheet a friend gave to me. It's rather long and all of the special css attributes, rather than being defined with -webkit or -moz, are defined with -ms, for Microsoft. Is there a way with regex to replace

-ms-something: somethingelse;

with

-ms-something: somethingelse;
-moz-something: somethingelse;
-webkit-something: somethingelse;
-o-something: somethingelse;

in a big mass replace? Thanks in advance.

Upvotes: 0

Views: 71

Answers (2)

colbydauph
colbydauph

Reputation: 364

I wrote this for BBEdit, but it should work for any text editor with grep replace.

Search

^-ms-(.*):(.*);$

Replace

-ms-\1:\2;
-moz-\1:\2;
-webkit-\1:\2;
-o-\1:\2;

Example

Before-Replace

-ms-property: value;

After-Replace

-ms-property: value;
-moz-property: value;
-webkit-property: value;
-o-property: value;

Upvotes: 0

Casimir et Hippolyte
Casimir et Hippolyte

Reputation: 89565

You can try this:

search: -ms-([^;]+;)
replace: $0\r\n-o-$1\r\n-moz-$1\r\n-webkit-$1\r\n

Upvotes: 2

Related Questions