Remove style rule with RegExp

HTML

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style id="head_style">
    html {
      margin: 0px;
      height: auto;
    }
    
    body {
      height: auto;
      padding: 10px;
      background: transparent;
      color: #000000;
      position: relative;
      z-index: 2;
      -webkit-user-select: auto;
      margin: 0px;
      overflow: hidden;
      min-height: 20px;
    }
    
    body:after {
      content: "";
      display: block;
      clear: both;
    }
    
    body::-moz-selection {
      background: #b5d6fd;
      color: #000;
    }
    
    body::selection {
      background: #b5d6fd;
      color: #000;
    }
    
    body,
    textarea {
      min-height: 500px !important;
    }
    
    body,
    body:focus {
      outline: transparent solid 0px;
    }
    
    body {
      background: transparent;
      position: relative;
      z-index: 2;
      overflow-x: auto;
      user-select: auto;
    }
    
    body a {
      user-select: auto;
    }
    
    body img.test {
      max-width: calc(100% - 10px);
    }
    
    body table td,
    body table th {
      border: 1px solid rgb(221, 221, 221);
    }
    
    body table td:empty,
    body table th:empty {
      height: 20px;
    }
    
    body table td,
    body table th {
      border: 1px double red;
    }
    
    body table td,
    body table th {
      border-width: 2px;
    }
    
    body table th {
      background: rgb(230, 230, 230);
    }
    
    body hr {
      clear: both;
      user-select: none;
      break-after: page;
    }
    
    body img {
      display: inline-block;
      float: none;
      vertical-align: bottom;
      margin-left: 5px;
      margin-right: 5px;
      max-width: calc(100% - 10px);
    }
    
    body {
     ...

JavaScript

var style = $('#head_style');
var styleTxt = style.text();

$('#before').html(styleTxt.replace(/(body\s*img([\w -:%;.{]+)})/g, '<mark>$1</mark>'));

var styleTxt = style.text().replace(/(body\s*img([\w -:%;.{]+)})/g, "img {}");
$('#after').text(styleTxt);