Posts

Showing posts with the label regular-expressions

Play with Python Regular Expressions Like Tennis

Image
Regular Expressions are something like to find a matching string in another string. You will get either 'True' or 'False' as a response. I am not sharing here how to play tennis. My intention is if you just follow ideas, you can play tennis today. Python Regular Expressions What is a regular expression How does python support Best examples Let us start - What is Regular Expression. >>> haystack = 'My phone number is 213-867-5309.'  >>> '213-867-5309' in haystack  True This is just a fundamental use of the regular expression. The real use of Regular Expression comes here. That is - to find if the main has any valid phone number. Regular expressions also called regexes. Two Main Reasons Why We use Regular Expressions Data mining - to get required data if it is present are not Data validations - to get an answer if the received string is valid or not. How Python Supports Python has its own regular expression library. That is called re . Wh