Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search at dream weaver using regular expression

Tags:

regex

css

Hello i am trying to find and replace all at Dreamweaver using regular expression.

My CSS:

.class1{
  position:relative;
  float:left;
  margin: 2px 1px 0px 0px;
} 

.class2{
  position:relative
  float:left;
  margin: 0px 1px 0px 0px;
}

Now i want to find all margin using regular expression and want to replace them by adding !important at the last.

Already i can find using regular expression by using this

margin:.*?;

Now i want to replace all margin with !important using regular expression at Dreamweaver. example

margin: 0px 1px 0px 0px !important;

can anybody give solution.

like image 493
wahid Avatar asked Apr 30 '26 08:04

wahid


1 Answers

Tested in DW CS6

Search: margin:((?:\s*\d+px)+)\s*;

Replace: margin:$1 !important;

I made the regex a bit specific so we don't add !important when we already have !important :)

like image 159
zx81 Avatar answered May 01 '26 21:05

zx81



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!