Answers for "regex in python pattern match"

3

python regex match words

# credit to Stack Overflow user in source link

import re
re.search(r'bisb', your_string)
Posted by: Guest on May-27-2021
9

python regex

import re

# Regex Cheat sheet : https://www.dataquest.io/blog/regex-cheatsheet/
# Regex python tester : https://pythex.org/
# re doc : https://docs.python.org/3/library/re.html

text = "i like train" 
reg = r"[a-c]" #the group of char a to c

if re.match(reg, text): #Check if regex is correct
	print(text)
else:
  print("Not any match")
Posted by: Guest on September-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language