php - Regular Expression To Extract Lines Not Containing HTML Block Tags -


I'm looking for a regular expression to remove all the adjacent lines containing HTML block tags Yes, but HTML can be inline tags . For example, if I have the following text ...

  bla bla bla bla bla & lt; Code & gt; Bla bla & lt; / Code & gt; Bla bla bla bla bla & lt; Img src = "" alt = "" / & gt; Bla bla bla bla & lt; Div & gt; Bla bla bla bla bla bla  

... I just want to remove the following lines ...

  bla bla bla bla bla & lt; Code & gt; Bla bla & lt; / Code & gt; Bla bla bla bla bla & lt; Img src = "" alt = "" / & gt; Bla bla bla bla  

Is it possible to do this with regular expressions?

Update: I am also working with PHP and I have a variable named Block Tags block tag is an open tag or closed tag, then It does not matter.

"h1" | Div ";

Stop exploring Your task requires an analyzer, Can open and close, and it is something that can not do classical regular expressions

Modern Reggae may be able to pull such a move, but you will be creating the most awesome unreadable regex in the world which is ever seen (well, not quite enough, but close) and If you ever need to change the behavior, then you may end up writing the whole thing again, then write a relatively simple parser and do it for yourself, and spend hours creating some reggae so that someone else Spend the hours trying to understand later.

By the way, if you have a regex question, specify which language you are using, they work a bit differently in different languages.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -