Regular expressions (Regex) are an extremely versatile tool for matching, searching, and manipulating text in Python. (using module re)
- Validating Email Addresses
- Extracting Phone Numbers
- Parsing CSV Data
- Extracting URLs
- Finding Duplicate Words
- Extracting Hashtags
- Extracting IP Addresses
PythonRegexKaggle.py : (Kaggle Source)
- Is string alphanumeric
- Match string: has an 'a' followed by none or more 'b's
- Match string: has an 'a' followed by one or more b's
- Match string: has an 'a' followed by zero or one 'b's
- Match string: has an 'a' followed by three 'b's
- Match string: has an 'a' followed by two or three 'b's
- Find sequences of: lowercase letters joined with a underscore
- Find sequences of: one upper case letter followed by lower case letters
- Match string: has an 'a' followed by anything, ending in 'b'
- Match a word at: the beginning of a string
- Match a word at: the end of string, with optional punctuation
- Match a word containing: 'z'
- Match a word containing: 'z', not at start or end of the word
- Match string: has only: upper/lowercase letters, numbers, underscores
- Match string: where it starts with a specific number
- Remove leading zeros from IP address
- Check for a number at the end of a string
- Search in a string: numbers(0-9) of length between 1-3
- Search: literal strings in a string
- Search: literal strings in a string & its location