Skip to content

Commit

Permalink
Case-Insensitive Matching, Matching with Quantifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
oneananda committed Oct 22, 2024
1 parent 16f1959 commit 2a2311f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 0004-Regular-Expressions-Match/regex_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
RESULT = re.match(r'[A-Za-z]+', 'Python Is Great123')
print(RESULT.group()) # Output: 'Python', Reason : It finds and matches the substring 'Python' up to the first space ' ' because the space is not part of [A-Za-z].

print('Case-Insensitive Matching')
RESULT = re.match(r'hello', 'Hello World', re.IGNORECASE)
print(bool(RESULT)) # Output: True



print('Matching with Quantifiers')
RESULT = re.match(r'\w{6}', 'abcde12345')
print(result.group()) # Output: 'abcde1'

0 comments on commit 2a2311f

Please sign in to comment.