From 8fe868091725362a801bdc9f8451b819e2765a6e Mon Sep 17 00:00:00 2001 From: Tomas Vitvar Date: Tue, 9 Aug 2011 14:25:16 +0000 Subject: [PATCH] regexp to parse a cell's position corrected --- examples/nodejs-example.js | 6 ++++-- lib/feed-tables.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/nodejs-example.js b/examples/nodejs-example.js index 0874923..e0b249c 100644 --- a/examples/nodejs-example.js +++ b/examples/nodejs-example.js @@ -36,7 +36,8 @@ var receive = function(dataUrl, dataReady) { }, 2000); }; -var ft = require('feed-tables'); +console.log(process.cwd()); +var ft = require(process.cwd() + '/lib/feed-tables.js'); receive("https://spreadsheets.google.com/feeds/cells/0AoooUkEfVrhldEpRekRVakVYWmJ2U2Z4SFBVZ0M1Nnc/od6/public/basic?alt=json", function(data) { @@ -49,4 +50,5 @@ receive("https://spreadsheets.google.com/feeds/cells/0AoooUkEfVrhldEpRekRVakVYWm } else console.log("Timeout while fetching the Google Spreadsheet data."); }); - \ No newline at end of file + + \ No newline at end of file diff --git a/lib/feed-tables.js b/lib/feed-tables.js index 99febff..5115ab8 100644 --- a/lib/feed-tables.js +++ b/lib/feed-tables.js @@ -123,7 +123,7 @@ var CellsFeed = function(data) { // we need to take care of cellnames like "AA203" etc var translateCellname = function(posStr) { - var result = posStr.match(/(.+)(\d+)/); + var result = posStr.match(/([A-Z]+)(\d+)/); var colTxt = result[1]; var r = result[2]; var c = 0; @@ -140,7 +140,7 @@ var CellsFeed = function(data) { var bin_search = function(f, t) { var p = (t-f)/2>>0; - var position = f + p - 1; + var position = f + p; var a = ft.data.entry[position].title.$t; var tr = translateCellname(a); var c = tr.c;