For example, a long article with HTML tags to get 400 characters of text, filter content conditions are, only left:
超链接,
label , Bold label , Italic label .
The remaining labels leave only plain text.
Remove line breaks and IMG tags. See more than two spaces replaced by a single space.
within 400 characters if , bold, italic labels are not closed to filter the rest of the contents of the closing tag.
400 characters If the hyperlink is not closed until the end of the hyperlink closes.
There are many examples on the web that do not fit. So I asked the question on SF. You do not want to delete the problem. The ability of the programmer to give help.
reply content:
For example a long article with HTML tags get 400 characters of text, filter content condition is, only left: hyperlink , label , Bold Label , Italic label .
The remaining labels leave only plain text.
Remove line breaks and IMG tags. See more than two spaces replaced by a single space.
within 400 characters if , bold, italic labels are not closed to filter the rest of the contents of the closing tag.
400 characters If the hyperlink is not closed until the end of the hyperlink closes.
There are many examples on the web that do not fit. So I asked the question on SF. You do not want to delete the problem. The ability of the programmer to give help.
Visually to write the regular match is replaced according to the condition, respectively. The
recommends looking through a regular tutorial and then splitting the requirements into multiple steps, conquer.
Update:
The need to solve the main problem in addition to string processing, in fact, can also be understood as the processing of the DOM, using JS to handle the DOM is more appropriate.
Previously used simple_html_dom This library, you can manipulate HTML like jquery, I hope it will be useful to you