Regular expression
“$” are different in basic regular expression and extend regular expression, see https://stackoverflow.com/questions/38114132/why-does-dollar-not-match-literal-dollar-when-extended-regex-ere-option-is-use.
https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html#posix_002degrep-regular-expression-syntax
- posix-egrep’ regular expression syntax:
- The characters ‘^’ and ‘$’ always represent the beginning and end of a string respectively, except within square brackets. Within brackets, ‘^’ can be used to invert the membership of the character class being specified.
- ‘posix-basic’ regular expression syntax:
-
The character ‘^’ only represents the beginning of a string when it appears:
-
At the beginning of a regular expression
-
After an open-group, signified by ‘(’
-
After the alternation operator ‘|’+ The character ‘$’ only represents the end of a string when it appears:
-
At the end of a regular expression
-
Before a close-group, signified by ‘)’
-
Before the alternation operator ‘|’
-
-