Skip to content
Advertisement

Tag: python-re

How to filter some urls from python list?

I wrote this code for extract images urls from a web page as I given. And it shows all images urls. But I need to filter “https://images.unsplash.com/profile” urls and print them. I tried; And didn’t worked! Answer You need to iterate through the images and then look if each of the image within images contains the required string or not.

Look for complement of unicode range in python

I have a set of words and I want to find those who contain non italian characters. Instead of providing all the possible unicode ranges of letters not belonging to the italian alphabet, I think it would be much better to specify the ranges of the allowed letters and then check if a string contains any character not belonging to

finditer with re.DOTALL starts analysis from span=(16,17). Why?

I’m trying to dismember a text file to sections with findall sort or action. I need backreferencing so I opt for finditer. Since I’m processing a text file w multiple lines – I need re.DOTALL. It works fine as long as the match doesn’t start in first 16 characters. The (over)simplified problem example: The output is: I expect 20 matches

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” in this example, and if the string has both of the words, then stop at the first one: You may have that thing NO you

Advertisement