Given a string and a character, write a Python program to replace multiple occurrences of the given character by a single character. Examples: Input :… Read More
Tag Archives: python-regex
While working with large sets of data, it often contains text data and in many cases, those texts are not pretty at all. The is… Read More
Let’s take a password as a combination of alphanumeric characters along with special characters, and check whether the password is valid or not with the… Read More
Given a string str, the task is to extract all the numbers from a string and find out the most occurring element of them using… Read More
Given a string str containing numbers and alphabets, the task is to find all the numbers in str using regular expression. Examples: Input: abcd11gdf15hnnn678hh4 Output: 11… Read More
Write a Python Program to find sequences of one upper case letter followed by lower case letters. If found, print ‘Yes’, otherwise ‘No’. Examples: Input… Read More
Prerequisites : Regular Expressions | Set 1, Set 2 Given a string, the task is to check if that string contains any g followed by… Read More
Given a string, the task is to check if that string contains any special character (defined special character set). If any special character found, don’t… Read More
Prerequisite : Pattern Matching with Python Regex Given the URL text-file, the task is to extract all the email-ids from that text file and print… Read More
Let suppose a situation in which you have to read some specific data like phone numbers, email addresses, dates, a collection of words etc. How… Read More
Given an IP address, remove leading zeros from the IP address. Examples: Input : 100.020.003.400 Output : 100.20.3.400 Input :001.200.001.004 Output : 1.200.1.4 Recommended Practice… Read More
Prerequisite: Pattern matching with Regular Expression In this article, we will need to accept a string and we need to check if the string contains… Read More
In this program, we will be taking a password as a combination of alphanumeric characters along with special characters, and checking whether the password is… Read More
A string contains patterns of the form 1(0+)1 where (0+) represents any non-empty consecutive sequence of 0’s. Count all such patterns. The patterns are allowed… Read More
Given an alphanumeric string, extract maximum numeric value from that string. Alphabets will only be in lower case. Examples: Input : 100klh564abc365bg Output : 564… Read More