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

  • SEARCH
  • Home
  • 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 7579537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:42:20+00:00 2026-05-30T17:42:20+00:00

html6= <p<ins style=background:#e6ffe6;>re><code</ins>> int aint bint c<ins style=background:#e6ffe6;></code></ins></p<ins style=background:#e6ffe6;>re</ins>><p>int d</p> Html6 and Html7 is

  • 0
html6="""
<p<ins style="background:#e6ffe6;">re><code</ins>>
int aint bint c<ins style="background:#e6ffe6;"></code></ins></p<ins style="background:#e6ffe6;">re</ins>><p>int d</p>
"""

Html6 and Html7 is the same , just Html7 has “\n”

html7="""
<p<ins style="background:#e6ffe6;">re><code</ins>>int a
int b
int c<ins style="background:#e6ffe6;">
</code></ins></p<ins style="background:#e6ffe6;">re</ins>>
<p>int d</p>
"""

p_to_pre_code_pattern = re.compile(
"""<p
<(?P<action_tag>(del|ins)) (?P<action_attr>.*)>re><code</(?P=action_tag)>
>
(?P<text>.*?)
<(?P=action_tag) (?P=action_attr)>
</code></(?P=action_tag)>
</p
<(?P=action_tag) (?P=action_attr)>re</(?P=action_tag)>
>""",re.VERBOSE)


print re.match(p_to_pre_code_pattern,html6)    
print re.match(p_to_pre_code_pattern,html7)

both html6 and html7 will not match ? ,but if i replace the “\n” to “” , it will much both .

print re.match(p_to_pre_code_pattern,html6.replace("\n",""))    
print re.match(p_to_pre_code_pattern,html7.replace("\n",""))

I want to know how should I change the p_to_pre_code_pattern that I will match both html6 and html7 without calling replace("\n","")) ?

  • 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-05-30T17:42:21+00:00Added an answer on May 30, 2026 at 5:42 pm

    Maybe you miss the re.DOTALL flag when call re.compile(..., re.VERBOSE|re.DOTALL)

    re.S 
    re.DOTALL 
    
    Make the '.' special character match any character at all, including a newline;
    without this flag, '.' will match anything except a newline.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The HTML: <div id=timerList> ... <li rel=project class=open> <a class= style= href=><ins>&nbsp;</ins>Project C</a> </li>
HTML (or maybe just XHTML?) is relatively strict when it comes to non-standard attributes
html code meta tag description, it is generated dynamically and we have quotes in
Sample code is below. If you look at it, you will see gray drop
I come across this: html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,d l,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,figure,footer,header,hgroup,menu,nav,section,menu,time,mark,audio,video{background:transparent;border:0;font-size:100%;list-style:none;margin:0;padding:0;outline:0;vertical-align:baseline;} The comment mention reset, I guess is used
Are there any add-ons (plug-ins) for Firefox to find unclosed HTML elements? Example: <div>
I'm pretty new with installing jQuery plug-ins, and I've only gone so far as
I'm looking for an official Adobe page explaining the ins and outs of the
First off, there's a bit of background to this issue available on my blog:
[CONFIRMED: IE9 suffers the same bug! :'( ] I have a div that is

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.