Wednesday, 19 December 2018

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/><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/><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/><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/><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/><br/><td class="td3" headers="searchth3">PHP3</td>';<br/>$dom = new DOMDocument();<br/>$dom->loadHTML($doc);<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/><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/> </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/2018/12/php-regex-to-retrieve-text-between-html.html' itemprop='url'/> <a class='timestamp-link' href='https://eclipsow.blogspot.com/2018/12/php-regex-to-retrieve-text-between-html.html' rel='bookmark' title='permanent link'><abbr class='published' itemprop='datePublished' title='2018-12-19T02:22:00-08:00'>December 19, 2018</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=2214557881205269020&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=2214557881205269020&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=2214557881205269020&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=2214557881205269020&target=twitter' target='_blank' title='Share to X'><span class='share-button-link-text'>Share to X</span></a><a class='goog-inline-block share-button sb-facebook' href='https://www.blogger.com/share-post.g?blogID=5208288551320960997&postID=2214557881205269020&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=2214557881205269020&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=2214557881205269020&hl=en-GB&saa=85391&origin=https://eclipsow.blogspot.com' 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/1167892209-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/2018/12/how-can-i-check-if-string-has-numeric.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/2018/12/hide-div-when-clicking-outside.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/2214557881205269020/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 ... </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/regex-splitting-string-and-removing.html'>regex - Splitting string and removing whitespace Python</a></div> <div class='item-snippet'>I would like to split a String by comma ',' and remove whitespace from the beginning and end of each split. For example, if I have ...</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/2019/12/c-how-to-take-async-result-in-getter.html'>c# - How to take async result in getter?</a></div> <div class='item-snippet'>I have a method in repository with this implementation which returns a Task Task > GetAllAppsRequestAsync(); I write the getter which cal...</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 collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </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 collapsed'> <a class='toggle' href='javascript:void(0)'> <span class='zippy'> ►  </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> </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 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/2018/'> 2018 </a> <span class='post-count' dir='ltr'>(3641)</span> <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/2018/12/'> December 2018 </a> <span class='post-count' dir='ltr'>(463)</span> <ul class='posts'> <li><a href='https://eclipsow.blogspot.com/2018/12/how-do-i-send-file-as-email-attachment_31.html'>How do I send a file as an email attachment using ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-use-of-undefined-constant-j-assumed.html'>php - Use of undefined constant j - assumed 'j'</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-regex-match-double-quote-in-bbcode.html'>php - Regex match the double quote in BBCode attri...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/what-regex-will-match-every-character.html'>What regex will match every character except comma...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-closure-how-come-i-refer-to.html'>javascript closure - how come I refer to an undecl...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-one-mysql-database-multiple-table.html'>php - One MySQL Database & Multiple Table</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/excel-parse-csv-ignoring-commas-inside.html'>excel - Parse CSV, ignoring commas inside string l...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-which-value-should-i-use-for.html'>html - Which "href" value should I use for JavaScr...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/mad-men-how-accurate-are-smoking-and.html'>mad men - How accurate are the smoking and drinkin...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/mod-rewrite-apache-modrewrite-is-not.html'>mod rewrite - apache mod_rewrite is not working or...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/excel-copy-and-paste-to-another-sheet.html'>excel - Copy and paste to another sheet first empt...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/is-there-better-way-to-do-optional.html'>Is there a better way to do optional function para...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/ios-xcode-6-playground-measuring-code.html'>ios - XCode 6 Playground Measuring Code Performance</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-parse-error-syntax-error-unexpected_30.html'>PHP Parse error: syntax error, unexpected T_CONSTA...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/matlab-how-to-add-text-in-box-with.html'>matlab - How to add text in a box with a leader to...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-how-do-i-apply-structure-offset.html'>c - How do I apply a structure offset?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/realism-why-didn-bomb-cause-tsunami-in.html'>realism - Why didn't the bomb cause a tsunami in D...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-postfix-screwing-up-email-headers.html'>php - Postfix screwing up email headers!</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/equivalent-of-c-extern-declaration-in.html'>Equivalent of C extern declaration in JavaScript</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/jquery-success-function-is-not-called.html'>Jquery success function is not called after execut...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-how-do-i-write-result-from.html'>javascript - How do I write the result from res.js...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/shell-difference-between-single-and.html'>shell - Difference between single and double quote...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-android-monospace-space-width-is.html'>html - Android monospace space ( ) width is differ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/arrays-accessing-number-object-in-php.html'>arrays - Accessing number object in php</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/python-how-to-fix-relative-import-in.html'>python - How to fix "Attempted relative import in ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/what-are-differences-between-pointer_29.html'>What are the differences between a pointer variabl...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-de-serialize-known-types-similar-to.html'>c# - (De-)Serialize Known Types similar to Microsoft</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/first-steps-in-learning-c.html'>First Steps in Learning C++</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-reading-text-document-character-by.html'>c++ - Reading a text document character by character</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/css3-what-does-tildesquiggletwiddle-css.html'>css3 - What does the "~" (tilde/squiggle/twiddle) ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-how-do-i-vertically-center-text.html'>html - How do I vertically center text?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-to-interact-from-python-script-to-c.html'>How to interact from python script to .C or .O file?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-setting-up-chromephp-for-wordpress.html'>php - Setting Up ChromePhp For Wordpress Using Xampp</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-sending-boolean-with-formdata.html'>php - Sending Boolean with FormData Javascript - V...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/why-can-i-type-alias-functions-and-use.html'>Why can I type alias functions and use them withou...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/when-to-use-linkedlist-over-arraylist.html'>When to use LinkedList over ArrayList in Java?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-css-sibling-selector-w-hover.html'>html - CSS Sibling Selector w/ Hover</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-parse-error-syntax-error-unexpected_29.html'>php - Parse error: syntax error, unexpected 'text'...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-reading-from-text-file-until-eof.html'>c++ - Reading from text file until EOF repeats las...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/realism-could-fire-hose-really-support.html'>realism - Could a fire hose really support the wei...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/mysql-how-to-alter-column-and-change.html'>mysql - How to alter a column and change the defau...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-collection-was-modified-enumeration.html'>c# - Collection was modified; enumeration operatio...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/design-patterns-what-is-dependency.html'>design patterns - What is dependency injection?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/pre-post-increment-operator-behavior-in.html'>Pre & post increment operator behavior in C, C++, ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/exception-why-should-i-not-wrap-every.html'>exception - Why should I not wrap every block in "...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-do-i-send-file-as-email-attachment.html'>How do I send a file as an email attachment using ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-both-next-and-nextline-not-helping.html'>java - Both next() and nextLine() not helping to s...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-how-to-measure-time-elapsed-immune.html'>java - How to measure time elapsed, immune to syst...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/python-saving-utf-8-texts-in-jsondumps.html'>python - Saving utf-8 texts in json.dumps as UTF8,...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/regex-group-in-perl-how-to-capture.html'>Regex Group in Perl: how to capture elements into ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-to-sort-array-by-date-in-javascript.html'>How to sort array by date In JavaScript?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/androidosnetworkonmainthreadexception.html'>android.os.NetworkOnMainThreadException sending an...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-android-output-list-of-events-from.html'>java - Android - Output List of events from Google...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-how-to-make-code-wait-while.html'>javascript - How to make code wait while calling a...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/x86-what-does-multicore-assembly.html'>x86 - What does multicore assembly language look l...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-improve-insert-per-second-performance_28.html'>c - Improve INSERT-per-second performance of SQLite?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/jquery-split-last-word-value-in.html'>jquery - Split last word value in JavaScript string</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/using-try-vs-if-in-python.html'>Using try vs if in python</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-how-to-emulate-ebo-when-using-raw.html'>c++ - How to emulate EBO when using raw storage?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-how-do-i-generate-random-int-number.html'>c# - How do I generate a random int number?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-magic-quotes-isn-off-strange-problam.html'>php - Magic quotes isn't off (Strange problam!)</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-why-is-processing-sorted-array.html'>java - Why is processing a sorted array faster tha...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-can-abstract-class-have-constructor.html'>java - Can an abstract class have a constructor?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-string-scanner-input-does-not-wait.html'>Java String Scanner input does not wait for info, ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-html-e-mail.html'>PHP HTML e-mail</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/hot-linked-questions_27.html'>Hot Linked Questions</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-get-localstorage-value-into.html'>javascript - Get localStorage value into php</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-webpage-encoding-utf-8.html'>php - Webpage encoding utf-8</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-passing-html5-local-storage.html'>javascript - Passing HTML5 Local Storage Value to ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/css-selectors-select-all-child-elements.html'>css selectors - Select all child elements recursiv...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/excel-vba-code-for-protecing-range-of.html'>excel - VBA code for protecing range of cells (use...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/performance-what-will-be-faster-or.html'>performance - What will be faster, >= or >?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-to-check-if-string-contains-another.html'>How to check if a String contains another String i...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/css-target-div-only-if-specific-child.html'>css - Target div only if specific child tag does n...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-why-does-mulss-take-only-3-cycles-on.html'>c - Why does mulss take only 3 cycles on Haswell, ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-make-body-have-100-of-browser.html'>html - Make body have 100% of the browser height</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-mysqli-fatal-error-call-to-member.html'>PHP & MySQLi Fatal error: Call to a member functio...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-why-does-jquery-or-dom.html'>javascript - Why does jQuery or a DOM method such ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-how-to-determine-if-variable.html'>javascript - How to determine if variable is 'unde...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-do-i-check-if-array-includes-value.html'>How do I check if an array includes a value in Jav...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/arrays-what-does-do-in-c-language.html'>arrays - What does ** do in C language</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/python-parsing-boolean-values-with.html'>python - Parsing boolean values with argparse</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-syntax-error-or-access-violation.html'>php - Syntax error or access violation: 1064</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/hot-linked-questions.html'>Hot Linked Questions</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/nodejs-how-to-show-data-from-mysql-in_26.html'>node.js - How to show data from mysql in nodejs wi...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/html-doesn-css-first-child-or-last.html'>html - Doesn't CSS first-child or last-child work ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/image-processing-can-sift-run-in.html'>image processing - Can SIFT run in realtime?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/jquery-event-in-javascript-object.html'>JQuery event in javascript object</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-drawing-image-in-jscrollpane.html'>java - Drawing an image in JScrollPane within scale</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/collections-how-can-i-turn-list-of.html'>collections - How can I turn a List of Lists into ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/javascript-watch-for-property-creation.html'>javascript - Watch for a property creation event?</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/getting-error-to-email-through-python.html'>Getting error to email through python script</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-reading-textfile-with-scanner.html'>java - Reading textfile with Scanner results in 'I...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/c-setup-projects-in-visual-studio-2015.html'>c# - Setup projects in Visual Studio 2015</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/php-sending-email-using-gmail-server.html'>php - sending email using gmail server</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/film-techniques-how-do-they-prevent.html'>film techniques - How do they prevent animal cruel...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-what-does-static-succeeded-only-by.html'>java - What does static succeeded only by two curl...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/python-methodfunction-arguments.html'>Python method/function arguments starting with ast...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/java-how-can-i-pad-integer-with-zeros.html'>java - How can I pad an integer with zeros on the ...</a></li> <li><a href='https://eclipsow.blogspot.com/2018/12/how-to-map-json-data-in-javascript-es6.html'>How to map JSON Data in Javascript ES6</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/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/2665675024-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY6jeNdK_oT0XyX78S4p6A8zUD6YcA:1752517373889';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d5208288551320960997','//eclipsow.blogspot.com/2018/12/php-regex-to-retrieve-text-between-html.html','5208288551320960997'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '5208288551320960997', 'title': 'Blog', 'url': 'https://eclipsow.blogspot.com/2018/12/php-regex-to-retrieve-text-between-html.html', 'canonicalUrl': 'https://eclipsow.blogspot.com/2018/12/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/2214557881205269020/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/249228b73f77f9d8', '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': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', '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': '2214557881205269020', '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 tag in this sce...', 'url': 'https://eclipsow.blogspot.com/2018/12/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': 2214557881205269020}}]); _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/2690454057-lbx__en_gb.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/123180807-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>