noon wrote:
That information might help huh. I want it to strip everything
inbetween body tags. The error was that I was either receiving nothing
or receiving the entire html including the head tags etc. I have since
seem to have got it working with this code:
xhr.responseText.split(/<body[^>]*>((.|\n|\r|\u2028|\u2029)*)<\/body>/
gi)[1];
With
foo<body>...</body>bar
this would give you
...
But you wanted to *strip* everything *in between*, _not_ split.
Though improvement suggestions are welcome
... = xhr.responseText.match(/<body(|\s+[^>]*)>((.|\s)*)<\/body>/i)[1];
is largely equivalent to your code in this case and more efficient.
However, IMHO that is still _not_ stripping everything in between but
*matching* everything in between, which is probably what you meant to say.
Note that (X)HTML is a context-sensitive language which cannot be parsed
with one regular expression (defining a regular language) alone. In your
case it should work because a Valid (X)HTML document MUST NOT have more
than one `body' element.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16