Skip to content
Advertisement

Tag: regex

How to parse paragraph in html using regex

I need to write a regex to parse $$ sign between paragraphs in an HTML page I tried But I need to apply the same even there are some styles exists in paragraph, Expected Input: Expected Output: please help Answer my answer is completely based on your approach, for a better solution, I suggest to parse the html and process.

Extract IBAN from text with Python

I want to extract IBAN numbers from text with Python. The challenge here is, that the IBAN itself can be written in so many ways with spaces bewteen the numbers, that I find it difficult to translate this in a usefull regex pattern. I have written a demo version which tries to match all German and Austrian IBAN numbers from

Python Pandas Extract word from column that contains String with Regex

I have this data frame (columns are strings): I need to get ‘ORF’ values for rows with ‘ORFDesc’ that contains a word with “hydro” but only with 13 characters. I explain, word length must be 13 characters, not the whole description. I’m using In order to match the rows that contain “hydro” but I need to reject the ones with

Where is such a regex wrong?

I am using python. The pattern is: The text like: I expect to get TVTP Answer Another option to match those formats is: Explanation ^ Start of string ([^-()]+) Capture group 1, match 1+ times any character other than – ( and ) (?:-[^()]*)? As the – is excluded from the first part, optionally match – followed by any char

Finding regex patterns regardless of spaces

There are strings (which are rows of a pandas data frame): 2.5807003.49 9/2020 24,54 4.7103181.69 9 /2020 172,05 4.7197189.46 09/2020 172,0 5 4.7861901.25 9/2020 8 9,16 2.5807003.49 10/2020 35,65 4.7103181.69 10/2020 185,50 4.7197189.46 1 0/2020 185,5 0 4.7861901.25 10/2020 94 ,32 What I need is to extract the following information from these lines (comma is decimal separator here): order_id date

How to target multiple strings with single regex pattern

I have multiple strings such as I want to target all these strings with regex. I tried the following pattern Here is the full code This outputs the following With this pattern, I am able to target the first three strings. But for the life of me, I am not able to figure out how to target the last string.

Using Python and Regex get last occurrence and remaining part

I’m trying to use python and regex to get the last set of integers in a filename (string) Which the method does what i need, however I want to also return the inverse or remaining parts of the regex. How can i do that? Here is the regex ([0-9]+|#+)(?!.*([0-9]+|#+)) Currently it is returning…. (’01’, None) I’d like it to return

Python Re.Sub Function Usage Issue

I need help with this re.sub function. For example, if I wanted to replace “string” with “abc” but I want #include <string.h> to remain the same so that the syntax does not get disturbed and all the other “string” variables get replaced with “abc”. How can I write the re.sub function? The Python code is: test_str is this Answer Use

Advertisement