0

I am trying to extract followers count from the data below:

{TruOptik': {follow_request_sent': False, profile_use_background_image': True, default_profile_image': False, id': 1308292578, profile_background_image_url_https': , verified': False, profile_text_color': 333333', profile_image_url_https': , profile_sidebar_fill_color': DDEEF6', entities': {url': {urls': [{url': http://t.co/wUe1yjBgtE', indices': [0, 22], expanded_url': http://truoptik.com/', display_url': truoptik.com'}]}, description': {urls': []}}, followers_count': 294, profile_sidebar_border_color': 000000', id_str': 1308292578', profile_background_color': 010A0F', listed_count': 39, status': {contributors': None, truncated': False, text': Effort only fully releases its reward after a person refuses to quit. Napoleon Hill #TruOptik http://t.co/pJH19C6CeP', in_reply_to_status_id': None, id': 464714440437268481L, favorite_count': 0, source': web', retweeted': False, coordinates': None, entities': {symbols': [], user_mentions': [], hashtags': [{indices': [84, 93], text': TruOptik'}], urls': [], media': [{expanded_url': , display_url': pic.twitter.com/pJH19C6CeP', url': , media_url_https': , id_str': 464714438142996480', sizes': {large': {h': 194, resize': fit', w': 259}, small': {h': 194, resize': fit', w': 259}, medium': {h': 194, resize': fit', w': 259}, thumb': {h': 150, resize': crop', w': 150}}, indices': [94, 116], type': photo', id': 464714438142996480L, media_url': , in_reply_to_screen_name': None, id_str': 464714440437268481', retweet_count': 0, in_reply_to_user_id': None, favorited': False, geo': None, in_reply_to_user_id_str': None, possibly_sensitive': False, lang': en', created_at': Fri May 09 10:32:11 +0000 2014', in_reply_to_status_id_str': None, place': None}, is_translation_enabled': False, utc_offset': None, statuses_count': 19327, description': Tru Optik named Gartner Cool New Vendor for Info-Innovation in Big Data 2014', friends_count': 187, location': Stamford, CT', profile_link_color': B39B00', profile_image_url': , following': False, geo_enabled': False, profile_banner_url': , profile_background_image_url': , screen_name': TruOptik', lang': en', profile_background_tile': True, favourites_count': 55, name': Tru Optik Data Corp', notifications': False, url':, created_at': Wed Mar 27 18:54:41 +0000 2013', contributors_enabled': False, time_zone': None, protected': False, default_profile': False, is_translator': False}

I tried this:

value.match(/.+((?<=followers_count': ).+(?=, profile_sidebar_border)).+/)

The code above is supposed to extract 294, but the newly created column contains null value. Anything wrong in my regular expression?

hwnd
  • 69,796
  • 4
  • 95
  • 132

1 Answers1

0

value.parseJson() returns the following error Error: parseJson failed: Missing value at 164 [character 165 line 1].

As a workaround your can use the split command value.split("followers_count':")[1].split(',')[0]

magdmartin
  • 1,712
  • 3
  • 20
  • 43