iam-veeramalla / python-for-devops

Learn Python from DevOps Engineer point of you.
MIT License
2.79k stars 5.61k forks source link

Python Day-02 03-regex-match.py #39

Open pramod-199 opened 7 months ago

pramod-199 commented 7 months ago

03-regex-match.py please check this file as im getting error of match not found mybe match only checks at the starting of string

pramod-199 commented 7 months ago

it should be like

import re

text = "quick brown fox" pattern = r"quick"

match = re.match(pattern, text) if match: print("Match found:", match.group()) else: print("No match")