On Mar 17, 4:10 am, kangax <kan...@gmail.com> wrote:
> On Mar 16, 1:13 pm, arkady <arkad...@gmail.com> 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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to