Solution with re module
###Solution with re module
YouYou can use the built-in re
module in Python for that.
import re
sr = re.split(' - |/',s)[1]
Field calculator view (where FeatureStr is the source field with 264K - Name of Place/FeatureType
and Split is the output field with : Name of Place
.
Pre-Logic Script Code:
def splitText(field):
import re
return re.split(' - |/', field)[1]
Field to be equal to:
splitText(!FeatureStr!)
Alternative solution with no re module:
!FeatureStr!.split(' - ')[1].split('/')[0]