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 8601753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:55:00+00:00 2026-06-12T01:55:00+00:00

I have this html code <span><style> .p9Wu{display:none} .JOz4{display:inline} .nitJ{display:none} .pIj0{display:inline} .AU2Q{display:none} .vDdS{display:inline} .THa1{display:none} .mRy1{display:inline}

  • 0

I have this html code

<span><style>
.p9Wu{display:none}
.JOz4{display:inline}
.nitJ{display:none}
.pIj0{display:inline}
.AU2Q{display:none}
.vDdS{display:inline}
.THa1{display:none}
.mRy1{display:inline}
</style><span style="display: inline">69</span><span class="JOz4">.</span><span style="display:none">21</span><div style="display:none">21</div><span style="display: inline">65</span><span style="display:none">212</span><span class="AU2Q">212</span><span style="display: inline">.</span><span class="144">46</span><span style="display:none">69</span><span class="237">.</span><span style="display:none">11</span><span class="AU2Q">11</span><div style="display:none">11</div><div style="display:none">36</div><span style="display: inline">60</span><div style="display:none">152</div></span>

When view on the browser, it shows this 69.65.46.60
I want to use PHP to strip out html and left only text 69.65.46.60

First problem that I don’t know how to write a pattern to get class the display:none
Second problem that my preg_replace is too long. Can someone help me to make it shorter? Thanks

This is my php code

$html = preg_replace('~<div([^>]*)(class\\s*=\\s*["\']p9Wu["\'])([^>]*)>(.*?)</div>~i', '', $html);
$html = preg_replace('~<div([^>]*)(class\\s*=\\s*["\']nitJ["\'])([^>]*)>(.*?)</div>~i', '', $html);
$html = preg_replace('~<div([^>]*)(class\\s*=\\s*["\']AU2Q["\'])([^>]*)>(.*?)</div>~i', '', $html);
$html = preg_replace('~<div([^>]*)(class\\s*=\\s*["\']THa1["\'])([^>]*)>(.*?)</div>~i', '', $html);

$html = preg_replace('~<span([^>]*)(class\\s*=\\s*["\']p9Wu["\'])([^>]*)>(.*?)</span>~i', '', $html);
$html = preg_replace('~<span([^>]*)(class\\s*=\\s*["\']nitJ["\'])([^>]*)>(.*?)</span>~i', '', $html);
$html = preg_replace('~<span([^>]*)(class\\s*=\\s*["\']AU2Q["\'])([^>]*)>(.*?)</span>~i', '', $html);
$html = preg_replace('~<span([^>]*)(class\\s*=\\s*["\']THa1["\'])([^>]*)>(.*?)</span>~i', '', $html);

$html = preg_replace('~<div([^>]*)(style\\s*=\\s*["\']display:none["\'])([^>]*)>(.*?)</div>~i', '', $html);
$html = preg_replace('~<span([^>]*)(style\\s*=\\s*["\']display:none["\'])([^>]*)>(.*?)</span>~i', '', $html);

$html = preg_replace('@<style[^>]*?>.*?</style>@siu', '', $html);

$html = strip_tags($html);
  • 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-12T01:55:01+00:00Added an answer on June 12, 2026 at 1:55 am

    You can crunch your divs and spans together like so:

    $html = preg_replace('~<(div|span)([^>]*)(class\\s*=\\s*["\'](p9Wu|nitJ|AU2Q|THa1)["\'])([^>]*)>(.*?)</\1>~i', '', $html);
    $html = preg_replace('~<(div|span)([^>]*)(style\\s*=\\s*["\']display:none["\'])([^>]*)>(.*?)</\1>~i', '', $html);
    
    $html = preg_replace('@<style[^>]*?>.*?</style>@siu', '', $html);
    
    $html = strip_tags($html);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I have HTML code like this: <asp:LinkButton ID=AddButton runat=server OnClick=AddPatientBtn_Click> <span class=Normal>Add</span> </asp:LinkButton> I
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input
I have a HTML code like this: <pre><div class=post style=border-width:1px;border-style:solid> <div class=userpic style=width:70px;float:left> <img
Hello I have this html structure. <span class=radio style=background-position: 0px 0px; ></span> I just
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have this html code that i want to edit with jQuery. Here is
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script

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.