I have a string something like this:
opt/custom/building/BuildingInput/address/BuildingUnderwritingInput/Name
I need to catch all the words having 'Input' and delete them from the path. So my final string will be:
opt/custom/building/address/Name
I tried something like this but it didnt work
x = "opt/custom/building/BuildingInput/address/BuildingUnderwritingInput/Name"
re.sub(r'Input/', r'/' , x.rstrip())
And it gave me
opt/custom/building/Building/address/BuildingUnderwriting/Name
The "Building" of "BuildingInput" and "BuildingUnderwriting" of "BuildingUnderwritingInput" are retained here. I want the whole word 'BuildingInput" and "BuildingUnderwritingInput" to be omitted. Any help? Or if anyone can tell me how I can backtrace from occurrence of "Input" to the first occurrence of "/" so that I can match the whole word "BuildingInput" and "BuildingUnderwritingInput"