I am trying to understand the following Basic Regular Expression pattern:
^^^
This is how I interpret it as:
The first caret character is treated as the anchor for marking the beginning of line.
The second and third caret characters are matched literally (as they are neither inside a character class to cause negation, and nor the first character to be treated as anchor).
So, as I understand, I expect it to match the occurrences of ^^
pattern at the beginning of a line. Do I understand it right?
However, it appears that the aforementioned regular expression matches every line in the file irrespective of its contents. This behaviour is observed when searching a text file in Sublime Text with Regex search mode enabled.
What am I missing? How do I correctly interpret the regular expression?
Update: I observe a different behavior when running the following command using bash shell:
grep "^^^" foo
where foo is the same text file as above. The regular expression matches all the lines containing the pattern ^^
towards the beginning of line.
I am now confused as to why the result differs in two cases, and how do I understand the behavior fully?