Matching the Whole Damm Regex in Python

Warning: the following code contains excessive use of regular expressions. Prolonged exposure may cause eye strain, headaches, and existential dread.

Example 1: Matching a Whole Number

Use the following code to match any whole number:

        import re
        print(re.search(r'\d+', '12345'))  # returns a match object
    

This will match any sequence of digits. Not exactly rocket science, but it's a good starting point.

Advanced Regex

Don't say we didn't warn you...