How to replace and insert a new substring in python?

This is a working code and mabybe not very effcient code to replace a substring with another substring previously modified Input string : text = [“part1 Pirates (2006)”, “part2 …

Python Regex DataFrame match

I have a DataFrame and I would like to perform a sorting if the match between my regex and the name of one of the lines of this DataFrame matches. Is there an option in the “re” library to …

Regex pattern for filename with date

I have files with name “data_2021_03_v1.0.zip” in server. When I tried using “data.*(ZIP|zip)” regex.It is loading all files starting with data string. I want files containing only …

Ignore text from dot to a specific character with regex python

I have a text like this: text = “Text1. Textt « text2 » Some other text” i want a regex code that is able to delete the text inside the quotes and the text before it till …

regex lookahead AND look behind

I have the following 2 variations of scraped data: txt = ”’Käuferprovision: 3 % zzgl. gesetzl. MwSt.”’ # variation 1 and txt = ”’Käuferprovision: Die Courtage i.H.v. % 3,57 inkl. MwSt. ist’…

Regex make a group optional

I have the below messages to parse Messages discarded due to Dispatch Queue cap: 0 / 60001 ms Dispatch Queue size: 2 Dispatched Messages: 369 / 60001 ms Dispatched message size: Average: 723, Entries: …

Not finding a good regex pattern to substitute the strings in a correct order(python)

I have a list of column names that are in string format like below: lst = [“plug”, “[plug+wallet]”, “(wallet-phone)”] Now I want to add df[] with ” ‘ ” to each …

Beautifulsoup : Unable to extract href with several conditions

I’m trying to extract every links with BeautifulSoup from the SEC website such as this one by using the code from this Github. The thing is I do not want to extract every 8-K but only the ones …

How to capture a group only if occurs twice in a line

import re text = “”” Tumble Trouble Twwixt Two Towns! Was the Moon soon in the Sea Or soon in the sky? Nobody really knows YET. “”” How should I make the match happen …

regex match not working on simple string with Pyteomics parser

I am performing an in silico digestion of the human proteome, meaning that I am trying to chopped the amino acid sequence of every protein at a certain position. I am using the Pyteomics parser …