Thanks Balazs

as you can see I try to do something very similar - with this code:

function nextStop(text) {
         var pos = text.length;
         var pos2 = text.indexOf(".");
         if (pos2 > 0 && pos >pos2) { pos = pos2 +
1};                                       // lastPos is the netx
Sentence stats
         var pos2 = text.indexOf("!");
         if (pos2 > 0 && pos >pos2) { pos = pos2 + 1};
         var pos2 = text.indexOf("?");
         if (pos2 > 0 && pos >pos2) { pos = pos2 + 1};
         var pos2 = text.indexOf("\n");
         if (pos2 > 0 && pos >pos2) { pos = pos2};

         if (pos == 0) { pos = text.length };

   return pos;

}

I thus try to narrow down to a clean snip of text and replaces this
snip with var myX = x.replace(str,result.translation);

I would simply try to bypass any HTML, line-breaks etc in the final
code, but for some reason the replace seems to corrupted when this is
done in IE.

I found this http://www.w3schools.com/jsref/jsref_regexp_modifier_newline.asp
- that says that you need to set the \n like this:

var str = "Visit W3Schools.\n Learn JavaScript.";
var patt1 = /\n/;
var result = str.search(patt1);
document.write("Match at: " + result);

Changing my code to use patt1 and search still works fine in FF but
not in IE... strange....

Regards Per

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX API" 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/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to