Note that there are some explanatory texts on larger screens.

plurals
  1. PORegex paterns to remove word formatting
    primarykey
    data
    text
    <p>I am having a problem using regex patterns to replace items in HTML markup. The values that I am trying to replace are these:</p> <pre><code>&lt;!--[if mso 9]--&gt; &lt;style&gt; p.MsoNormal&lt;br /&gt; {margin-left:18.75pt;}&lt;br /&gt; &lt;/style&gt; &lt;!--[endif]--&gt; </code></pre> <p>and</p> <pre><code>class="MsoNormal" </code></pre> <p>I am not the best at using Regex the patterns that I have come up with so far are:</p> <ol> <li><code>&lt;!--(.*?)--&gt;</code></li> <li><code>class=\"msonormal\"</code></li> <li><code>class=\"MsoNormal\"</code></li> </ol> <p>Item 1 removes anything that starts with <code>&lt;!--</code> and ends with <code>--&gt;</code> but it only does it once it doesn't remove all instances.</p> <p>I don't think items 2 and 3 are working at all.</p> <p>I found some of this information for the patterns here:</p> <p><a href="https://stackoverflow.com/questions/1349837/is-there-a-way-to-strip-all-unnecessary-ms-word-formatting-from-fckeditor">is there a Way to strip all Unnecessary MS Word Formatting from FCKEditor</a></p> <p>The full listing of text that I want to remove is this:</p> <pre><code> &lt;!--[if !mso]&gt;&lt;style&gt;v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt;&lt;![endif]--&gt; &lt;title&gt;Blank&lt;/title&gt; &lt;style&gt; &lt;!-- /* Font Definitions */ @font-face {font-family:Helvetica; panose-1:2 11 6 4 2 2 2 2 2 4;} @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} @font-face {font-family:"Arial Black"; panose-1:2 11 10 4 2 1 2 2 2 4;} @font-face {font-family:"Palatino Linotype"; panose-1:2 4 5 2 5 5 5 3 3 4;} @font-face {font-family:"Trebuchet MS"; panose-1:2 11 6 3 2 2 2 2 2 4;} @font-face {font-family:"Matura MT Script Capitals"; panose-1:3 2 8 2 6 6 2 7 2 2;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin-top:0in; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; font-size:10.0pt; font-family:"Helvetica","sans-serif"; color:#FFFFCC; mso-believe-normal-left:yes;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p {mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; font-size:12.0pt; font-family:"Times New Roman","serif";} p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {mso-style-priority:99; mso-style-link:"Balloon Text Char"; margin-top:0in; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; font-size:8.0pt; font-family:"Tahoma","sans-serif"; color:#FFFFCC;} p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing {mso-style-priority:1; margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman","serif";} span.BalloonTextChar {mso-style-name:"Balloon Text Char"; mso-style-priority:99; mso-style-link:"Balloon Text"; font-family:"Tahoma","sans-serif"; color:#FFFFCC;} span.EmailStyle21 {mso-style-type:personal; font-family:"Arial","sans-serif"; color:black;} span.EmailStyle22 {mso-style-type:personal; font-family:"Arial","sans-serif"; color:#0F243E;} span.EmailStyle23 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle24 {mso-style-type:personal; font-family:"Arial","sans-serif"; color:#0F243E;} span.EmailStyle25 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle26 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle27 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle28 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle29 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:windowtext;} span.EmailStyle30 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle31 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle33 {mso-style-type:personal-reply; font-family:"Calibri","sans-serif"; color:#1F497D;} .MsoChpDefault {mso-style-type:export-only; font-size:10.0pt;} @page WordSection1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in;} div.WordSection1 {page:WordSection1;} --&gt; &lt;/style&gt; &lt;!--[if mso 9]--&gt; &lt;style&gt; p.MsoNormal {margin-left:18.75pt;} &lt;/style&gt; &lt;!--[endif]--&gt;&lt;!--[if gte mso 9]&gt; &lt;o:shapedefaults v:ext="edit" spidmax="1026" /&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/p&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload