0

I want to find all occurrences of "color: " inside my html below. But problem is that I get one previous character as well selected.

Note: I dont want "background-color:"

Please help

Test link - http://regexr.com/?385gg

HTML

<div id="divSection">
  <div class="section-topcurve" style="background-color: rgb(224, 99, 32);">
    <div class="app-input" id="Div11" onclick="CellDoubleClick(this,50)" style="color: rgb(156, 117, 156); background-color: rgb(224, 99, 32);">Item 1</div>
"asd-color:rgb(156,2,3);
"color: rgb(156, 117, 156);
    <span class="additem">
      <a id="Section" href="" onclick="return AddnewItem(this.id);">add item</a>
    </span>
  </div>
  <div class="section-nocurve" id="divSection1390991308640" style="background-color: rgb(189, 114, 73); color: rgb(51, 51, 51);">
    <div class="app-input" id="cellSection1390991308640" style="background-color: rgb(189, 114, 73); color: rgb(143, 24, 143);">New Item</div>
  </div>
  <div class="section-btmcurve" id="divSection1390991552843" style="background-color: rgb(189, 114, 73); color: rgb(143, 24, 143);">
    <div class="app-input" id="cellSection1390991552843" style="background-color: rgb(189, 114, 73);">New Item</div>
  </div>
</div>
Ankit
  • 5,983
  • 7
  • 46
  • 74

1 Answers1

0

This should do the trick for you:

[\s"](color:\s{0,1}.*?\))

Regular expression visualization

Debuggex Demo

Mike Perrenoud
  • 63,395
  • 23
  • 143
  • 222