Learn Before
Code

RegEx {} Code Example

import re txt = "Basketball is my favorite sport!" #Check if txt contains "a" followed by exactly two "l" characters: x = re.findall("al{2}", txt) print(x) if x: print("Match!") else: print("No match") #Since "basketball" has an "a" followed by exactly two "l" characters #it will print "Match!"

0

1

Updated 2021-08-24

Tags

Python Programming Language

Data Science