@ I remove entire line which contains specific words I select entire line with "starting string" and "ending string" @ # I remove entire line which contains specific words refinedaddress = str(onevideo).replace('<a href="', 'https://channel9.msdn.com/').replace('">', '\nabove video\'s title : ').replace('</a>','') listremovedtitle = result_text = re.sub(r'(above video).*', '', refinedaddress).replace('\n\n', '\n') or simply, above.+\n https://channel9.msdn.com//Shows/The-Open-Source-Show/Part-1-of-4-Create-a-Web-Application-and-push-it-into-Docker-Hub above video's title : Part 1 of 4: Create a Web Application and push it into Docker Hub https://channel9.msdn.com//Shows/ifdefWINDOWS/ifdef-WINML above video's title : #ifdef WINML - Windows Machine Learning https://channel9.msdn.com//Shows/This+Week+On+Channel+9/TWC9-MVP-Summit-Windows-Developer-Day-International-Womens-Day-and-more https://channel9.msdn.com//Shows/The-Open-Source-Show/Part-1-of-4-Create-a-Web-Application-and-push-it-into-Docker-Hub https://channel9.msdn.com//Shows/ifdefWINDOWS/ifdef-WINML https://channel9.msdn.com//Shows/This+Week+On+Channel+9/TWC9-MVP-Summit-Windows-Developer-Day-International-Womens-Day-and-more @ I select entire line with "starting string" and "ending string" In.+]: In.+]:$ In [19]: @ I select entire sentence which doesn't contain abc ^((?!abc)[\s\S])*$