Learn Before
Code

RegEx | Code Example

import re txt = "beat" #Check if txt contains either "bear" or "bean": x = re.findall("bear|n", txt) if x: print("Match!") else: print("No match") #Since txt is "beat", it will print "No match"

0

1

Updated 2021-08-24

Tags

Python Programming Language

Data Science