html - Regex to detect all characters outside of the <img> tag -
I do not have experience in regex. I'm just trying to find a way to detect and remove each character outside the img tag. In other words, I want to strip the HTML code given to all the text and tags and just put everything in the IGG tags. The result should be just that image tag shown:
& lt; Img src = "sourcehere" & gt;
Is there any way to do this?
UPDATE: I need a regex in particular which goes into preg_replace which I have done, but it does not work:
$ buffer = " gt;> head> gt ::
& lt; / body & gt; & Lt; / html & gt; "; $ Buffer = pre_legal ('(? I) & lt; (?! Img | / img). *? & Gt;', '', $ buffer); Buffer $ buffer; / * Output & lt; Img src = 'image.jpg' & gt; But this is not what you plan for - * /
Log in or display in a console, or output it somehow it works for me, but in fact 'stringing' can be additional work.
It's jQuery, I think you want to remove everything, but the picture from your document. Var arr2 = Array.prototype.slice.call (document.images); .. JQuery ('body') content (removal) (); (I = 0; i & lt; arr2.length; i ++) {jQuery ('body'). Endand (AR2 [I])}
Comments
Post a Comment