Skip to content
Advertisement

Tag: regex

Python, Regex, extract grouped emails within curly brackets

I’m trying to extract multiple Emails from string. I’m using this regex: It works fine, but sometimes in text Email names with the same domain are grouped in curly brackets: So my question is how properly to parse it and extract as separate emails: annie@gmail.com, bonnie@gmail.com? I’ve tried to modify regex to take into account brackets and comma, following with

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 : Output string: It has to replace substring like ‘part1’ ‘part2 an so on , with ‘PT’ and copy it between title and year substring Code: but when the list is like this I dont know how to

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 help me? I try with this piece of code but without success Thank you in advance for your answers Answer I

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 data(exactmatch-no extra words along with it) in filename. Ex: It is loading files with name “data_abc_efg_19-01-v2.0.zip” along with original file. Can someone help to construct a regex pattern for above file format Answer

Find value from string using the characters from list Using Python

I have been working on an Excel sheet using python, where i have to extract only the specific value from the column, using an list with set of charaters. Need to check every character from the column check with the list, If it matches need to return the matched value into the dataframe which can be used for further analysis.

regex lookahead AND look behind

I have the following 2 variations of scraped data: and I’d like to make one regular expression that gets the percentage as a float, so in the first instance 3.0 and in the second 3.57 I’ve tried this so far: Which works for the variation 2 but not variaton 1. Answer You may try this code to grab your percent

Regex make a group optional

I have the below messages to parse The regex which I have so far is I am able to match almost everything I except the line Dispatch Queue size: 2 Looks like the last group in my regex should be optional. I tried using ? but I am unable to figure out the proper syntax. Can someone please suggest the

Advertisement