Displaying just city/state/country on SearchBox location

I have a searchbox to let people select a geographic location and it allows entering address data at the street number level (i.e., 1234 Main Street). I’m using that geo data elsewhere and extracting just the city (if it exists), state (if city doesn’t exist), or country (if state doesn’t exist) and that’s working the way I’d like.

I want to reinforce this level of display to users when they’re entering their location information by simplifying what they enter in this box to show in the same way it does elsewhere (i.e., not including the street number info). I’ve tried using similar logic to extract that info and display it as the default value but it’s not working:

Is this possible?

You’ll need to build out google api specific for your app to do this. It’s very annoying.

I have a Google Map API key and Google Geocode API key set up (and yeah, definitely a pain); do you mean something beyond those?