regex-lookarounds

Regex whitelisted url lets blocked urls through on the same line in message

Regex whitelisted url lets blocked urls through on the same line in message Question: So I have a regex expression which blocks URLs in a message, but I want to whitelist the site’s URL. currently it works with any prefix like HTTP://www.example.com and with www.example.com/support/how-do-i-setup-this but if I put another URL behind this then it …

Total answers: 1

Regex Expression not spanning newlines

Regex Expression not spanning newlines Question: I have a string of data as a result of another working regex: pattern = re.compile(r’CALL|d*|.*n*((?:n.*)+?)(?=nCALL|Z)’,re.MULTILINE) matches = pattern.finditer(text) list_dataframe = [] audit_data = [] counter = 0 for match in matches: while counter < 1: small_string = match.group(0) print(small_string) print(‘end small string n’) pattern1 = re.compile(r’BENCHMARK|Assigned|(?:.*)(?=|Assigned||Z)’,re.MULTILINE) # assignments_iterator …

Total answers: 1

How to add a whitespace before "((VERB)" only if it is not preceded by a space or the beginning of the string?

How to add a whitespace before "((VERB)" only if it is not preceded by a space or the beginning of the string? Question: import re #input string example: input_text = "((VERB)ayudar a nosotros) ár((VERB)ayudar a nosotros) Los computadores pueden ((VERB)ayudar a nosotros)" #this give me a raise error("look-behind requires fixed-width pattern") re.error: look-behind requires fixed-width …

Total answers: 2

Regex validate string contains letters and numbers regardless of special characters

Regex validate string contains letters and numbers regardless of special characters Question: For password validation in Python, I need to make a regex, which validates that passwords contains both letters and numbers. I have this regex: re.match(r"^[A-Za-z]+d+.*$", password) But if the password contains a special character, then it won’t pass. So password for example "MyPassword6" …

Total answers: 3

Regular expression to capture n words after pattern that do not contain that pattern

Regular expression to capture n words after pattern that do not contain that pattern Question: I’m trying to write a regular expression that captures n words after a pattern, which was answered in this question, except I want the search to keep going for another n words if it encounters that pattern again. For example, …

Total answers: 2

Pandas REGEX not returning expected results using "extract"

Pandas REGEX not returning expected results using "extract" Question: I am attempting to use REGEX to extract connection strings from blocks of text in a pandas dataframe. My REGEX works on REGEX101.com (see Screenshot below). Link to my saved test here: https://regex101.com/r/ILnpS0/1 When I try to run the REGEX in a Pandas dataframe, I don’t …

Total answers: 1

Regular expressions python – get only the description V2

Regular expressions python – get only the description V2 Question: i am, again, trying to get description with RE Python modules, and i am almost done, but not everything, so.. I want to extract the description for this list; list = [‘Fatura Original-2ª via’, ‘Nº Z200 1/8206881085 Data 12-10-2022 Moeda EUR25505003116’, ‘NIF PT507399870 Cliente 25505 …

Total answers: 1

How to match part of the string contains certain word

How to match part of the string contains certain word Question: I want to be able to match the following texts top of radio 54 / bottom 27 radio top 54 / bottom 27 The word top can be before or after radio only for the first half of the text (before /). top that …

Total answers: 1