Special Sequences in Python Regex
1. \A and \Z – String Anchors \A – Matches ONLY at the beginning of the string \Z – Matches ONLY at the end of the string Example 1: \A – Start of string python import re text = “Hello World\nHello Python” pattern = r”\AHello” # Match “Hello” only at the VERY beginning matches =…