How to find words ending with ing

Parentheses "capture" text from your string. You have '(ing\b)', so only the ing is being captured. Move the open parenthesis so it encompasses the entire string that you want: r'\b(\w+ing)\b'. See if that helps.


Your capture grouping is wrong try the following :

>>> s="sharing all the information you are hearing"
>>> re.findall(r'\b(\w+ing)\b',s)
['sharing', 'hearing']

Also you can use str.endswith method within a list comprehension :

>>> [w for w in s.split() if w.endswith('ing')]
['sharing', 'hearing']