Friday 8 March 2019

PHP Regex to Retrieve the Text between HTML tags but not tags



Similar question might be asked many times but I have a bit complex one.
I know when we want to parse only the text between </code> tag in this scenario,<br /></p><br/><br/><pre><code><title>My work

This is my work.

Learning regex.




we can form a Regex like this:




>([^<]*)<


Source



But that works only because the </code> tag is on the top. But if the tag is the second one, it won't work.<br />Okay, my scenario is, <br /></p><br/><br/><pre><code><td class="td1" headers="searchth1">JAVA1</td><br/><td class="td2" headers="searchth2">JAVA2</td><br/><td class="td3" headers="searchth3">JAVA3</td><br/><br/><br/><td class="td1" headers="searchth1">PHP1</td><br/><td class="td2" headers="searchth2">PHP2</td><br/><td class="td3" headers="searchth3">PHP3</td><br/></code></pre><br/><br/><p>There are many similar tags in the file, and I want to retrieve only the text between <code><td class="td1" headers="searchth1"></code> and <code></td></code> tags.<br />And, I've used <code>'#<td class="td1" headers="searchth1">(.*)</td>#'</code> , which is working fine. But it is also including all other <code><td></code> tags in the output, which I don't want.<br />I want only the texts <code>Java1</code> and <code>PHP1</code> and I guess if I could able to retrieve the text between the tags by excluding the tags, I may acieve it. <br />Am I correct? or Wrong? If so, how to achieve what I want?<br />Thanks in advance!! </p><br/> </div><div class="post-text" itemprop="text"> <div style="font-weight: bold;"><p class="normal">Answer</p> <br/></div><br/><p>I think your regex approach, while technically possible, is going to cause more trouble down the line. For example, if the source HTML changed so the <code>headers</code> attribute appeared before the <code>class</code> attribute the regex would fail. Also, your code will become pretty unreadable very quickly if you're using regex to search through HTML source code.</p><br/><br/><br/><p>To parse HTML you should use PHP's DOMDocument functions, which are more robust in the face of changing HTML code and are far more readable to whoever may be maintaining your code (including you). This method will also support looking at other element attributes more easily. The sample code below should work for your use case:</p><br/><br/><pre><code>$doc = '<td class="td1" headers="searchth1">JAVA1</td><br/><td class="td2" headers="searchth2">JAVA2</td><br/><td class="td3" headers="searchth3">JAVA3</td><br/><td class="td1" headers="searchth1">PHP1</td><br/><td class="td2" headers="searchth2">PHP2</td><br/><td class="td3" headers="searchth3">PHP3</td>';<br/>$dom = new DOMDocument();<br/>$dom->loadHTML($doc);<br/><br/>$xpath = new DOMXpath($dom);<br/>$tds = $xpath->query("//td[@class='td1']");<br/>// the query could also be "//td[@headers='searchth1']" or even<br/>// "//td[@headers='searchth1'][@class='td1']" depending on what you want to target<br/>foreach($tds as $td){<br/> var_dump($td->nodeValue);<br/>}<br/></code></pre><br/><br/><p>If you want to learn more about building and using xpath queries, I suggest the article <a href="http://www.sitepoint.com/php-dom-using-xpath/" rel="nofollow">PHP DOM: Using XPath</a> over at SitePoint.com.</p><br/><br/> </div> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='post-author vcard'> </span> <span class='post-timestamp'> - <meta content='https://eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html' itemprop='url'/> <a class='timestamp-link' href='https://eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2019-03-08T11:13:00-08:00'>March 08, 2019</abbr></a> </span> <span class='post-comment-link'> </span> <span class='post-icons'> <span class='item-control blog-admin pid-2098421642'> <a href='https://www.blogger.com/post-edit.g?blogID=5208288551320960997&postID=2307432484255864463&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> <div class='post-share-buttons goog-inline-block'> <a class='goog-inline-block share-button sb-email' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2307432484255864463&target=email' target='_blank' title='Email This'><span class='share-button-link-text'>Email This</span></a><a class='goog-inline-block share-button sb-blog' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2307432484255864463&target=blog' onclick='window.open(this.href, "_blank", "height=270,width=475"); return false;' target='_blank' title='BlogThis!'><span class='share-button-link-text'>BlogThis!</span></a><a class='goog-inline-block share-button sb-twitter' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2307432484255864463&target=twitter' target='_blank' title='Share to Twitter'><span class='share-button-link-text'>Share to Twitter</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2307432484255864463&target=facebook' onclick='window.open(this.href, "_blank", "height=430,width=640"); return false;' target='_blank' title='Share to Facebook'><span class='share-button-link-text'>Share to Facebook</span></a><a class='goog-inline-block share-button sb-pinterest' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2307432484255864463&target=pinterest' target='_blank' title='Share to Pinterest'><span class='share-button-link-text'>Share to Pinterest</span></a> </div> </div> <div class='post-footer-line post-footer-line-2'> <span class='post-labels'> </span> </div> <div class='post-footer-line post-footer-line-3'> <span class='post-location'> </span> </div> </div> </div> <div class='comments' id='comments'> <a name='comments'></a> <h4>No comments:</h4> <div id='Blog1_comments-block-wrapper'> <dl class='avatar-comment-indent' id='comments-block'> </dl> </div> <p class='comment-footer'> <div class='comment-form'> <a name='comment-form'></a> <h4 id='comment-post-message'>Post a Comment</h4> <p> </p> <a href='https://www.blogger.com/comment/frame/5208288551320960997?po=2307432484255864463&hl=en-GB' id='comment-editor-src'></a> <iframe allowtransparency='true' class='blogger-iframe-colorize blogger-comment-from-post' frameborder='0' height='410px' id='comment-editor' name='comment-editor' src='' width='100%'></iframe> <script src='https://www.blogger.com/static/v1/jsbin/2315299244-comment_from_post_iframe.js' type='text/javascript'></script> <script type='text/javascript'> BLOG_CMT_createIframe('https://www.blogger.com/rpc_relay.html'); </script> </div> </p> </div> </div> </div></div> </div> <div class='blog-pager' id='blog-pager'> <span id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://eclipsow.blogspot.com/2019/03/asynchronous-nodejs-vs-aspnet-async.html' id='Blog1_blog-pager-newer-link' title='Newer Post'>Newer Post</a> </span> <span id='blog-pager-older-link'> <a class='blog-pager-older-link' href='https://eclipsow.blogspot.com/2019/03/sorting-in-javascript-shouldn-returning.html' id='Blog1_blog-pager-older-link' title='Older Post'>Older Post</a> </span> <a class='home-link' href='https://eclipsow.blogspot.com/'>Home</a> </div> <div class='clear'></div> <div class='post-feeds'> <div class='feed-links'> Subscribe to: <a class='feed-link' href='https://eclipsow.blogspot.com/feeds/2307432484255864463/comments/default' target='_blank' type='application/atom+xml'>Post Comments (Atom)</a> </div> </div> </div><div class='widget FeaturedPost' data-version='1' id='FeaturedPost1'> <div class='post-summary'> <h3><a href='https://eclipsow.blogspot.com/2020/01/php-filegetcontents-shows-unexpected.html'>php - file_get_contents shows unexpected output while reading a file</a></h3> <p> I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q... </p> <img class='image' src='\"data:image/jpg;base64,".$contents."\"/'/> </div> <style type='text/css'> .image { width: 100%; } </style> <div class='clear'></div> </div><div class='widget PopularPosts' data-version='1' id='PopularPosts1'> <div class='widget-content popular-posts'> <ul> <li> <div class='item-content'> <div class='item-title'><a href='https://eclipsow.blogspot.com/2018/08/database-android-studio-show-username.html'>database - Android Studio: show username in textview with SQLite</a></div> <div class='item-snippet'>I have an app which needs a login and a registration with SQLite. I have the database and a user can login and register. But i would like th...</div> </div> <div style='clear: both;'></div> </li> <li> <div class='item-content'> <div class='item-title'><a href='https://eclipsow.blogspot.com/2018/08/how-to-solve-javalangarrayindexoutofbou.html'>How to solve the java.lang.ArrayIndexOutOfBoundsException: 1 >= 0 error in my java program?</a></div> <div class='item-snippet'>I got an error in my Java program. I think this happens because of the constructor is not intialized properly. My Base class Program public ...</div> </div> <div style='clear: both;'></div> </li> <li> <div class='item-content'> <div class='item-title'><a href='https://eclipsow.blogspot.com/2018/05/c-enhanced-rep-movsb-for-memcpy.html'>c - Enhanced REP MOVSB for memcpy</a></div> <div class='item-snippet'>I would like to use enhanced REP MOVSB (ERMSB) to get a high bandwidth for a custom memcpy . ERMSB was introduced with the Ivy Bridge micro...</div> </div> <div style='clear: both;'></div> </li> </ul> <div class='clear'></div> </div> </div></div> </div> </div> <div class='column-left-outer'> <div class='column-left-inner'> <aside> </aside> </div> </div> <div class='column-right-outer'> <div class='column-right-inner'> <aside> <div class='sidebar section' id='sidebar-right-1'><div class='widget BlogSearch' data-version='1' id='BlogSearch1'> <h2 class='title'>Search This Blog</h2> <div class='widget-content'> <div id='BlogSearch1_form'> <form action='https://eclipsow.blogspot.com/search' class='gsc-search-box' target='_top'> <table cellpadding='0' cellspacing='0' class='gsc-search-box'> <tbody> <tr> <td class='gsc-input'> <input autocomplete='off' class='gsc-input' name='q' size='10' title='search' type='text' value=''/> </td> <td class='gsc-search-button'> <input class='gsc-search-button' title='search' type='submit' value='Search'/> </td> </tr> </tbody> </table> </form> </div> </div> <div class='clear'></div> </div><div class='widget BlogArchive' data-version='1' id='BlogArchive1'> <h2>Blog Archive</h2> <div class='widget-content'> <div id='ArchiveList'> <div id='BlogArchive1_ArchiveList'> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2020/'> 2020 </a> <span class='post-count' dir='ltr'>(79)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2020/01/'> January 2020 </a> <span class='post-count' dir='ltr'>(79)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/'> 2019 </a> <span class='post-count' dir='ltr'>(5283)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/12/'> December 2019 </a> <span class='post-count' dir='ltr'>(475)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/11/'> November 2019 </a> <span class='post-count' dir='ltr'>(449)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/10/'> October 2019 </a> <span class='post-count' dir='ltr'>(447)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/09/'> September 2019 </a> <span class='post-count' dir='ltr'>(466)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/08/'> August 2019 </a> <span class='post-count' dir='ltr'>(486)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/07/'> July 2019 </a> <span class='post-count' dir='ltr'>(423)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/06/'> June 2019 </a> <span class='post-count' dir='ltr'>(418)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/05/'> May 2019 </a> <span class='post-count' dir='ltr'>(439)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/04/'> April 2019 </a> <span class='post-count' dir='ltr'>(431)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate expanded'> <a class='toggle' href='javascript:void(0)'> <span class='zippy toggle-open'> ▼  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/03/'> March 2019 </a> <span class='post-count' dir='ltr'>(433)</span> <ul class='posts'> <li><a href='https://eclipsow.blogspot.com/2019/03/regex-in-java-regular-expression-back.html'>regex - In Java Regular Expression "1" (back refer...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/android-javaioioexception-received.html'>android - java.io.IOException: Received authentica...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-add-tags-to-text-outside-of.html'>javascript - Add tags to the text outside of bbcod...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/dom-php-domdocument-how-can-i-print.html'>dom - php DomDocument: how can i print an attribut...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/android-how-to-differentiate-between.html'>android - How to differentiate between long key pr...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/memory-management-how-can-i-demonstrate.html'>memory management - How can I demonstrate a zombie...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-adding-keypresskeydown-event.html'>javascript - Adding Keypress/keydown event on dyna...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/is-javascript-pass-by-reference-or-pass.html'>Is JavaScript a pass-by-reference or pass-by-value...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/tag-wiki-movies-tv_31.html'>'the-shawshank-redemption' tag wiki - Movies & TV</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/php-shorthand-for-arrays-is-there.html'>php - Shorthand for arrays: is there a literal syn...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-chaining-of-operator.html'>C++ chaining of the operator</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/create-new-column-based-on-existing.html'>Create new column based on existing columns in R S...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/curl-fetch-data-from-other-site-php-get.html'>curl - Fetch data from other site (php & GET)</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/java-2-loops-twice-faster-than-1-loop.html'>java - 2 "for" loops twice faster than 1 loop</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-sse-optimisation-for-loop-that-finds.html'>c++ - SSE optimisation for a loop that finds zeros...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-double-free-or-corruption-after.html'>c++ - Double free or corruption after queue::push</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-why-do-we-cast-return-value-of-malloc.html'>c - Why do we cast return value of malloc?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/updated-text-fields-to-json-string.html'>Updated text fields to JSON string - Javascript/JQ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/polymorphism-in-c.html'>Polymorphism in C++</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/html-center-h1-in-middle-of-screen.html'>html - center h1 in the middle of screen</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/how-to-implement-factory-method-pattern.html'>How to implement the factory method pattern in C++...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-how-to-splice-element-to.html'>javascript - How to splice an element to the start...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/security-how-does-sql-query.html'>security - How does SQL query parameterisation work?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/xampp-undefined-index-for-post-noob_30.html'>xampp - Undefined Index for $_POST (noob question!)</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/reactjs-typeerror-cannot-read-property.html'>reactjs - TypeError: cannot read property setState...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/methods-does-java-support-default.html'>methods - Does Java support default parameter values?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/what-is-difference-between-implicit-and.html'>What is the difference between implicit and explic...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/security-how-to-detect-sql-injection.html'>security - How to detect SQL Injection sitting at ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-comparing-float-variable.html'>c++ - comparing float variable</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/what-is-function-in-c.html'>What is a "static" function in C?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/character-what-nationality-is-bane.html'>character - What nationality is Bane? - Movies & TV</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-comparison-of-two-double-values-not.html'>c++ comparison of two double values not working pr...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/cast-one-dynamic-to-type-of-another-in-c.html'>Cast one dynamic to the type of another in c#</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-double-or-float-comparison.html'>c++ - double or float comparison</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/error-handling-php-failed-to-open.html'>error handling - PHP - failed to open stream: no s...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/sql-mysql-merging-multiple-rows-with.html'>sql - MySQL Merging multiple rows with the same ID...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-why-are-elementwise-additions-much.html'>c++ - Why are elementwise additions much faster in...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/garbage-collection-is-there-destructor.html'>garbage collection - Is there a destructor for Java?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/replace-newline-in-tsql.html'>Replace a newline in TSQL</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/xampp-undefined-index-for-post-noob.html'>xampp - Undefined Index for $_POST (noob question!)</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/mysql-sql-syntax-error-near.html'>mysql - SQL - Syntax error near ','</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/css-what-is-best-way-to-conditionally.html'>css - What is the best way to conditionally apply ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/java-tcp-server-on-android-phone_28.html'>java - TCP server on android phone crashes at .acc...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/java-threeten-backport-error-on-android.html'>java - ThreeTen-Backport error on Android - ZoneRu...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/hidden-features-of-c.html'>Hidden Features of C#?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/aspnet-aspnetcompiler-finding-wrong.html'>asp.net - aspnet_compiler finding wrong version of...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-constructordestructor-inheritance.html'>C++ Constructor/Destructor inheritance</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/php-sending-email-using-gmail-server.html'>php - sending email using gmail server</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/php-why-not-output-i-hope-result-in.html'>php - Why not output I hope result in PHP7 using t...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-how-do-i-add-class-to-given.html'>javascript - How do I add a class to a given element?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/plot-explanation-how-did-talia-find-her.html'>plot explanation - How did Talia find her father? ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/jvm-how-do-i-write-correct-micro.html'>jvm - How do I write a correct micro-benchmark in ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/algorithm-how-to-count-number-of-set.html'>algorithm - How to count the number of set bits in...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/function-in-python-setting-global.html'>Function in Python Setting Global Variables (witho...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-nullreferenceexception-was-unhandled.html'>c# - NullReferenceException was unhandled by user ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-why-strict-improves.html'>javascript - Why "use strict" improves performance...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/r-data-masking-in-dataframe.html'>r - Data Masking in Dataframe</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-virtual-member-call-in-constructor.html'>c# - Virtual member call in a constructor</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-writing-files-in-nodejs.html'>javascript - Writing files in Node.js</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/costume-gabriel-wristbands-in.html'>costume - Gabriel's Wristbands in Constantine</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/net-use-of-finalizedispose-method-in-c.html'>.net - Use of Finalize/Dispose method in C#</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/python-limiting-floats-to-two-decimal.html'>python - Limiting floats to two decimal points</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/how-to-generate-event-handlers-with.html'>How to generate event handlers with loop in Javasc...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-variadic-template-functions-no.html'>c++ - Variadic Template Functions: No matching fun...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/nodejs-find-version-of-installed-npm.html'>node.js - Find the version of an installed npm pac...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/php-how-to-use-strreplace-to-replace.html'>php - How to use str_replace to replace single and...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/android-unable-to-get-provider_26.html'>android - Unable to get provider com.facebook.inte...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-malloc-works-without-type-cast-before.html'>c - Malloc works without type cast before malloc</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/angular-how-to-loop-through-json-object.html'>angular - How to loop through a JSON object with t...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/android-parsing-xml-using-sax-parser.html'>android - Parsing XML using sax parser</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-assignment-operator-with-derived-type.html'>c++ - Assignment operator with derived type argument</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/android-sqlite-unable-to-read-after.html'>Android sqlite unable to read after updating a blob</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-typeerror-cannont-read.html'>javascript - TypeError: Cannont Read Property `Sta...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/performance-c-code-for-testing-collatz.html'>performance - C++ code for testing the Collatz con...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/java-basics-instantiation-of-objects.html'>Java Basics - Instantiation of objects</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/performance-emulator-is-starting-and.html'>performance - Emulator is starting and running slo...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/the-assignment-operator-in-r-does.html'>The Assignment Operator in R: Does "</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/bash-how-to-combine-these-two-commands.html'>bash - How to combine these two commands?: ./scrip...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-how-do-i-make-static-field.html'>javascript - How do I make a "public static field"...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/checking-if-strings-are-equal-in-java.html'>Checking if strings are equal in java using ==</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/excel-copy-cells-from-one-sheet-to.html'>excel - Copy cells from one sheet to another based...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/python-how-to-store-dataframe-using.html'>python - How to store a dataframe using Pandas</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/r-edits-in-ggplot2-geom.html'>r - edits in a ggplot2, geom = "line"</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/reactjs-javascript-iterating-over-json.html'>reactjs - Javascript: Iterating over JSON objects</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-how-to-remove-from-gccclang-assembly.html'>c++ - How to remove "noise" from GCC/clang assembl...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-implementing-idisposable-correctly.html'>c# - Implementing IDisposable correctly</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/net-breakpoint-will-not-currently-be.html'>.net - "The breakpoint will not currently be hit. ...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/casting-why-didn-katie-holmes-play.html'>casting - Why didn't Katie Holmes play Rachel Dawe...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/mysql-how-to-export-datatable-to-excel.html'>mysql - How to export datatable to excel in c# win...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/use-of-symbol-in-c.html'>Use of the '&' symbol in C++</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-always-round-up-to-x-decimal.html'>Javascript always round up to X decimal places</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-matrix-multiplication-small.html'>c - Matrix multiplication: Small difference in mat...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-how-to-convert-utf-8-byte-to-string.html'>c# - How to convert UTF-8 byte[] to string?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/reference-what-movie-is-kevin-from.html'>reference - What movie is Kevin from?</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/c-copying-linked-list-to-reference-to.html'>c++ - Copying a linked list to a reference to a li...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/java-unsupported-exception-in-jsf-20.html'>java - Unsupported Exception in jsf 2.0 + springwe...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/apache-modrewrite-convert-xxx-yyy-to.html'>apache - mod_rewrite convert: XXX-YYY to XXX.php?s...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/javascript-regex-to-validate-emails.html'>javascript - regex to validate emails which allows...</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/laravel-5-helper-functions.html'>Laravel 5 Helper functions</a></li> <li><a href='https://eclipsow.blogspot.com/2019/03/php-mysql-case-sensitive-table-names-in.html'>php - mysql case sensitive table names in queries</a></li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/02/'> February 2019 </a> <span class='post-count' dir='ltr'>(394)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2019/01/'> January 2019 </a> <span class='post-count' dir='ltr'>(422)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/'> 2018 </a> <span class='post-count' dir='ltr'>(3641)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/12/'> December 2018 </a> <span class='post-count' dir='ltr'>(463)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/11/'> November 2018 </a> <span class='post-count' dir='ltr'>(416)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/10/'> October 2018 </a> <span class='post-count' dir='ltr'>(456)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/09/'> September 2018 </a> <span class='post-count' dir='ltr'>(463)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/08/'> August 2018 </a> <span class='post-count' dir='ltr'>(447)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/07/'> July 2018 </a> <span class='post-count' dir='ltr'>(442)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/06/'> June 2018 </a> <span class='post-count' dir='ltr'>(420)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/05/'> May 2018 </a> <span class='post-count' dir='ltr'>(227)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2018/01/'> January 2018 </a> <span class='post-count' dir='ltr'>(307)</span> </li> </ul> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2017/'> 2017 </a> <span class='post-count' dir='ltr'>(1271)</span> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2017/12/'> December 2017 </a> <span class='post-count' dir='ltr'>(487)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2017/11/'> November 2017 </a> <span class='post-count' dir='ltr'>(432)</span> </li> </ul> <ul class='hierarchy'> <li class='archivedate collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </span> </a> <a class='post-count-link' href='https://eclipsow.blogspot.com/2017/10/'> October 2017 </a> <span class='post-count' dir='ltr'>(352)</span> </li> </ul> </li> </ul> </div> </div> <div class='clear'></div> </div> </div></div> <table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'> <tbody> <tr> <td class='first columns-cell'> <div class='sidebar no-items section' id='sidebar-right-2-1'></div> </td> <td class='columns-cell'> <div class='sidebar no-items section' id='sidebar-right-2-2'></div> </td> </tr> </tbody> </table> <div class='sidebar no-items section' id='sidebar-right-3'></div> </aside> </div> </div> </div> <div style='clear: both'></div> <!-- columns --> </div> <!-- main --> </div> </div> <div class='main-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> <footer> <div class='footer-outer'> <div class='footer-cap-top cap-top'> <div class='cap-left'></div> <div class='cap-right'></div> </div> <div class='fauxborder-left footer-fauxborder-left'> <div class='fauxborder-right footer-fauxborder-right'></div> <div class='region-inner footer-inner'> <div class='foot no-items section' id='footer-1'></div> <table border='0' cellpadding='0' cellspacing='0' class='section-columns columns-2'> <tbody> <tr> <td class='first columns-cell'> <div class='foot no-items section' id='footer-2-1'></div> </td> <td class='columns-cell'> <div class='foot no-items section' id='footer-2-2'></div> </td> </tr> </tbody> </table> <!-- outside of the include in order to lock Attribution widget --> <div class='foot section' id='footer-3' name='Footer'><div class='widget Attribution' data-version='1' id='Attribution1'> <div class='widget-content' style='text-align: center;'> Theme images by <a href='http://www.istockphoto.com/portfolio/nicolecioe?platform=blogger' target='_blank'>nicolecioe</a>. Powered by <a href='https://www.blogger.com' target='_blank'>Blogger</a>. </div> <div class='clear'></div> </div></div> </div> </div> <div class='footer-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </footer> <!-- content --> </div> </div> <div class='content-cap-bottom cap-bottom'> <div class='cap-left'></div> <div class='cap-right'></div> </div> </div> </div> <script type='text/javascript'> window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); </script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/4009268638-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY4nKcByt6unV5H6t_wJF8OzVlP-RQ:1730330552137';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d5208288551320960997','//eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html','5208288551320960997'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '5208288551320960997', 'title': 'Blog', 'url': 'https://eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html', 'canonicalUrl': 'https://eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html', 'homepageUrl': 'https://eclipsow.blogspot.com/', 'searchUrl': 'https://eclipsow.blogspot.com/search', 'canonicalHomepageUrl': 'https://eclipsow.blogspot.com/', 'blogspotFaviconUrl': 'https://eclipsow.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en-GB', 'localeUnderscoreDelimited': 'en_gb', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://eclipsow.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Blog - RSS\x22 href\x3d\x22https://eclipsow.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/5208288551320960997/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Blog - Atom\x22 href\x3d\x22https://eclipsow.blogspot.com/feeds/2307432484255864463/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': true, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/89335447f6baec0c', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'Twitter', 'key': 'twitter', 'shareMessage': 'Share to Twitter', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en_GB\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '2307432484255864463', 'pageName': 'PHP Regex to Retrieve the Text between HTML tags but not tags', 'pageTitle': 'Blog: PHP Regex to Retrieve the Text between HTML tags but not tags'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard', 'ok': 'Ok', 'postLink': 'Post link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'PHP Regex to Retrieve the Text between HTML tags but not tags', 'description': 'Similar question might be asked many times but I have a bit complex one. I know when we want to parse only the text between \x3c/code\x3e tag in t...', 'url': 'https://eclipsow.blogspot.com/2019/03/php-regex-to-retrieve-text-between-html.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 2307432484255864463}}]); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/2110117918-lbx__en_gb.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/13464135-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_FeaturedPostView', new _WidgetInfo('FeaturedPost1', 'main', document.getElementById('FeaturedPost1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_PopularPostsView', new _WidgetInfo('PopularPosts1', 'main', document.getElementById('PopularPosts1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogSearchView', new _WidgetInfo('BlogSearch1', 'sidebar-right-1', document.getElementById('BlogSearch1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-1', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull')); </script> </body> </html>