Permalink
Browse files

Fix parsing of city state zip info from stock profile info.

  • Loading branch information...
1 parent ff218f3 commit 6eb18dc7f207ee7c635c2c8f4790cdf133c83d50 Tom Powers committed Apr 30, 2010
Showing with 10 additions and 6 deletions.
  1. +10 −6 yahoo/finance/yahoo.finance.stock.xml
@@ -110,14 +110,18 @@
var m = mapref.match(/addr=([^&]+)&csz=([^&]+)&country=(.*)$/i);
if (m) {
var address = m[1].replace(/%20/g, " ");
-
- csz = m[2].split(/\+/);
- var city = csz[0].replace(/%20/g, " ");
- var state = csz[1];
- var zip = csz[2];
-
var country = m[3].replace(/%20/g, " ");
+ var csz = m[2].replace(/%20/g, " ");
+ var m2 = csz.match(/(.*?)\s+([a-z]+)\s+([-\d]+)$/i);
+ if (m2) {
+ var city = m2[1];
+ var state = m2[2];
+ var zip = m2[3];
+ } else {
+ var city = csz;
+ }
+
var address =
<Address>
<Street>{address}</Street>

0 comments on commit 6eb18dc

Please sign in to comment.