I'm looking for a way to clean strings from their longest repeating pattern.
I have a list of approximately 1000 web pages titles, and they all share a common suffix, which is the name of the website.
They follow this pattern:
['art gallery - museum and visits | expand knowledge',
'lasergame - entertainment | expand knowledge',
'coffee shop - confort and food | expand knowledge',
...
]
How could I automatically strip all strings from their common suffix " | expand knowledge"
?
Thanks!
Edit: Sorry, I did not make myself clear enough.
I have no information about the " | expand knowledge"
suffix in advance.
I want to be able to clear a list of strings of a potential common suffix, even if I do not know what it is.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…