Regex – match until a group of multiple possibilities

I have the following text: You may have that thing NO you dont BUT maybe yes I’m trying to write a regex which can match everything until it finds some specific words, “NO” and “BUT&…

regex substitute every appearance of a capture group with another capture group

I am reformatting a large set of sales data. Each sale shows the name of the item, number of items being sold, and the price rounded to the nearest whole number. 1 bag of 20 Apples sold for $3: Apple/,…

Segregate a column data based on regex using pandas

I have a dataframe like as shown below df = pd.DataFrame({‘val’: [‘>1234′,’<>‘,’<1000','

How to split with Dot without splitting links

I want to split on dot (.) but I don’t want to splits the links. Let’s say the string is –

This is a paragraph. I want to split it. Link

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 …