I am using the following code in Google app script to extract a number.
function getBTC_ZAR_ExchangeRate() {
var response = UrlFetchApp.fetch("http://coinmill.com/rss/BTC_ZAR.xml")
var xmlText = response.getContentText();
//var funded = Xml.parse(htmlText, true);
var rate = xmlText.match(/BTC =\s(.*?)\sZAR<br/);
return rate[1];
}
I get an array with two items as a result. Only the second item in the array is the correct one.
result = {"BTC = 27.45 ZAR<br", "27.45"}
What am I doing wrong, because this cannot be the way it is suppose to work?