Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8841529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:44:26+00:00 2026-06-14T10:44:26+00:00

I am having a problem using regex patterns to replace items in HTML markup.

  • 0

I am having a problem using regex patterns to replace items in HTML markup. The values that I am trying to replace are these:

<!--[if mso 9]-->
<style>
 p.MsoNormal<br />
 {margin-left:18.75pt;}<br />
</style>
<!--[endif]-->

and

class="MsoNormal"

I am not the best at using Regex the patterns that I have come up with so far are:

  1. <!--(.*?)-->
  2. class=\"msonormal\"
  3. class=\"MsoNormal\"

Item 1 removes anything that starts with <!-- and ends with --> but it only does it once it doesn’t remove all instances.

I don’t think items 2 and 3 are working at all.

I found some of this information for the patterns here:

is there a Way to strip all Unnecessary MS Word Formatting from FCKEditor

The full listing of text that I want to remove is this:

    <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<title>Blank</title>
<style>
    <!--
/* 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;}
-->
</style>
<!--[if mso 9]-->
<style>
    p.MsoNormal
    {margin-left:18.75pt;}
</style>
<!--[endif]--><!--[if gte mso 9]>
<o:shapedefaults v:ext="edit" spidmax="1026" />
<![endif]--><!--[if gte mso 9]>


<p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: #1f497d;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:44:27+00:00Added an answer on June 14, 2026 at 10:44 am

    Try this pattern for catching the first group of items:

    \<\!\-\-\[i[\w\s\p{P}\p{S}]+if\]\-\-\>
    

    The point is to avoid .* as far as possible for it will eat the whole input string hence the ending criteria is not matched.

    For the 2nd and 3rd, you only need to escape the = sign as in \=. They would be fine, however try the following pattern to catch other Mso* classes too:

    class\=\"Mso[^\"]+\"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out a problem I'm having with regex. I'm using this
I'm trying to figure out a Java regex problem that I'm having. This is
I keeping having the problem trying to extract data using regex whereas my result
I'm having a problem using the sed substitution option that executes a command in
I'm having a problem with using this in js. I have a function that
I'm using a 3rd party app that uses regex to searches html documents, in
I'm pretty new on grails, I'm having a problem in matches validation using regex.
I am having a problem with a generic regex that matches (sort of) a
I'm having a problem using the Boost library in Dev C++, specifically the regex
Ok so I am having trouble solving a problem with having a Regex using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.