I have a series of strings that I need to eliminate a series of text. The text can be variable in length, so doing any trim or strip functions will not work. The string is:
<img src="X:\UB_Routing\images\ServiceOrders\150 E MAIN ST.png"><br>150 E MAIN ST
or
<img src="X:\UB_Routing\images\ServiceOrders\3207 SE ROSESPRING DR.png"><br>3207 SE ROSESPRING DR
As a few examples, but they can be any address.
I am looking for a Python field calculator solution to remove everything before and including the value of <br>
From the examples above, the only values left would be:
150 E MAIN ST
3207 SE ROSESPRING DR
Solved! Go to Solution.
Try using
!FieldName![!FieldName!.rindex('>')+1:]
Thank worked Kevin, thank you!
Nice solution! I've been trying to repurpose this to remove all characters AFTER a certain character, but I'm stuck. Could you help, please?
I was looking for that too and I found it on another thread (Removing text after comma). I was trying to remove characters after a &. I'm not sure the link will link to the thread.
!YourFieldName!.split(",")[0]
my_string = '<img src="X:\UB_Routing\images\ServiceOrders\150 E MAIN ST.png"><br>150 E MAIN ST'
print my_string.split('<br>')[1]
150 E MAIN ST