On Mar 17, 4:10 am, kangax <[email protected]> wrote:
> On Mar 16, 1:13 pm, arkady <[email protected]> wrote:
>
> > if trying to strip off the everything before the <body> and everything
> > after </body>
>
> response.replace(/.*(?=<body>)/, '').replace(/(<\/body>).*/, '$1');

That seems a bit risky, the string may not always have lower case tag
names and the body opening tag may include attributes.  New lines in
the string might trip it up too.  In any case, it doesn't work for me
at all in Firefox 3 or IE 6.

An alternative, provided all new lines are removed, is:

  response.match(/<body.*body>/i)[0];

or

  response.replace(/\s/g,' ').match(/\<body.+body\>/i)[0];


A sub-string version is:

  var start = response.toLowerCase().indexOf('<body');
  var end = response.toLowerCase().indexOf('</body>') + 7;
  var theBody = response.substring(start, end)


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to