i
Python functionality and evolution
Installing Python (windows and Ubuntu)
IDLE (Integrated Development and Learning Environment)
Write the first python program and execute it
Keywords in Python
Identifiers in Python
Indentation in Python
Comments in Python
Multi-line Comments in Python
Getting user input
Python Function
Calling a function
Arguments in Function
Scope of Variables
Modules in Python
The PYTHON PATH-Variable
Python File Open
Python File Opening Modes
The file-Object-Attributes
Python File Close() Method
Python File Read/Write
Python File Position
Renaming and Deleting Files in Python
Python Directory Methods
File/Directory Methods
Exceptions in Python
The try-finally Clause
The argument of Exception
Raising Exceptions
Python Built-in Exceptions
Python OOPs Concepts
Python Classes/Objects
Creating Instance Objects
Accessing Attributes
Built-In Class Attributes
Garbage Collection
Python Inheritance
Overriding Methods
Method overriding
Data Hiding
Regular Expression
The match function
The search function
Match Object Methods & Description
Matching or Searching
Search or Replace
Regular Expression Modifiers / Option Flags
Grouping with Parentheses
Python Socket Programming
Python Socket Server
Python Socket Client
Send Data Between Clients
Python Socket or Server
Python Socket Clients
Points to ponder
Regular expression literals include an optional modifier to control various aspects matching. The modifiers are specified optional-flag. You can use multiple modifiers by exclusive (OR (|), as shown-previously:
Modifier & Description
re.I
Performs case/insensitive matching.
re.L
Interprets words according to current locale. This interpretation affects alphabetic group (\w and \W), as word boundary behavior(\b and \B).
re.M
Makes $ match the end of line and makes ^ match the start of any line
re.S
Period (dot) match any characterincluding the newline.
re.U
Interprets letters according to Unicode character set. This flag affects behavior of \w, \W, \b, \B.
re.X
Permits "cuter" regular expression syntax. ignores whitespace (except inside set [] or when escaped by a backslash and treats un-escaped # as comment marker.
Regular-Expression-Patterns
Except for control character (+ ? . * ^ $ ( ) [ ] { } | \), all characters match themselves. You can escape control character by preceding with backslash.
The following table lists regular expression syntax:
Pattern use Description ^
Matches beginning of line $
Matches end of line .
Matches single character except newline [...]
Matches single/character in brackets [^...]
Matches single/character not in brackets re*
Matches 0 or more occurrences in preceding expression re+
Matches 1 or more occurrence inpreceding expression re?
Matches 0 or 1 occurrence inpreceding expression re{ n}
Matches exactly n number of occurrences in preceding expression re{ n,}
Matches n or more occurrences in preceding-expression re{ n, m}
Matches at the least n and at most m occurrences in preceding-expression a| b
Matches a / b (re)
Groups regular expression used matching text (?imx)
Toggles on i, m, or x options regular expression.
If in parentheses only that area affected (?-imx)
Toggles off i, m, or x options in regular expression.
If in parentheses only that area affected (?: re)
Groups regular-expressions without ponder/matched text (?imx: re)
Temporarily-toggles on i, m, or x options in parentheses (?-imx: re)
Temporarily-toggles off i, m, or x optionin parentheses (?#...)
Regular-Expression-Examples
Literal-characters
Example & Description
python
Match "python".
Character-classes
Example & Description
[Pp]ython
Match "Python" or "python"
rub[ye]
"ruby" or "rube"
[aeiou]
Match any lowercase vowel
[0-9]
Match any digit; 0123456789]
[a-z]
Match any lowercase ASCI-letter
[A-Z]
Match any uppercase ASCII-letter
[a-zA-Z0-9]
Match any of above
[^aeiou]
Match anything other thanlowercase vowel
[^0-9]
Match anything than a digit
Don't miss out!