Why Technology in Business is Beneficial?

The role of technology in business today is essential. In recent years, technology has given a new and improved approach on how to deal with business thus making the transactions smoother, faster and…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Regular Expression In Python Part 1

Regular Expression can be think of as a god send weapon to find patterns in a string. Although regular expression are present in all the prominent programming languages and even word processors this article will be about the application of regular expression in python.

Lets say we want to find the a phone number inside a string. The phone number look like this 415–555–4242.

Lets create a method without regular expression for finding a phone number in a string.

Input

Although the above code works, It took a 17 lines and lot of ifstatement just to check a simple pattern.If we want to find something complex the code can become a lot messier.

Regular Expression simplify pattern searching to the point it seems like magic.

Heres how will we create the above program using regular expression.

This article just contains the light introduction to Regular Expression. There are lot of important topics likes groups, which i will address in next series of this article which i will release shortly.

Add a comment

Related posts:

Resentment is the most useless emotion

The earliest time I can recall feeling truly resentful was sometime in my sophomore year of high school. I played sports, and I was trying to be good enough to maybe get a college scholarship. My mom…

What are Te benefits of Using VPN

A Virtual Private Network (VPN) provides several benefits to users. Here are some of the advantages of using a VPN: Security: A VPN encrypts your internet traffic, making it more difficult for…

Vicious Cycle versus Virtuous Circle!

This theme brings me right to the idea, the image of the rat drum that rotates and where mice and other rodents “exercise” without stopping. This is typically the Vicious Cycle par excellence, where…