iam-veeramalla / python-for-devops

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

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

Open pramod-199 opened 6 months ago

pramod-199 commented 6 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 6 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")