c# - Regex to detect incomplete HTML -



c# - Regex to detect incomplete HTML -

i'm trying write search , replace regex observe whether html has been returned web request complete. have had cases when server returns incomplete html (half of page), want observe in client , request page again.

i thinking regex presence of <html[^>]*>, , absence of </html>. replace part replace whole html bit of special text.

i can't check absence of </html> because returned info might text file, , can't check mime types.

any ideas? can't wrap head around look-behinds require. i'm not trying parse html, searching bits of text, regexes for, right?

edit:

the regexes run c#, write them in regex editor. can utilize search , replace regex solve this, nil else.

oded correct. cannot parse html regex. of course of study can see whether (multiline) string contains <html> not followed </html>. if sure whatever web request returns consistent , not contain weird things html tags within comments, then

<html\b[^>]*>(?:(?!<\s*/\s*html).)*\z

will find such string, if set "dot matches newlines" option. how depends on regex implementation didn't provide yet.

<html\b[^>]*> # match <html> tag (?: # match following: (?!<\s*/\s*html) # if it's impossible match </html here . # match character )* # 0 or more times. \z # assert indeed @ end of string

c# regex

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -