D
D
DollyPapper2017-10-22 14:22:57
Python
DollyPapper, 2017-10-22 14:22:57

Highlighting endings with regular expressions?

It was necessary to select urgently to go through a large text with regular expressions. I briefly read how to write them, but I can’t finish it myself, here is the text, let’s say [doing, wing, ingot]. How to write in such a way that the ending is removed in duing and that the ingot is not touched? Well, that is, how to look for a pattern at the end of a word, if it is not a separate word, but a whole sentence?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
longclaps, 2017-10-22
@DollyPapper

print(re.sub(r'ing\b', '', "[doing, wing, ingot]"))

F
Fudo Tsukiko, 2017-10-22
@FudoTsu

https://regex101.com/r/ZJ2MgE/1

A
Alexander, 2017-10-22
@zkelo

You can try like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question