These metacharacters do not cause the engine to advance through the string or consume characters. They simply succeed or fail depending on the current position in the string. For instance, ^ specifies that the current position is at the beginning of a line or string. So the regular expression ^FTP will only return those occurrences of the character string "FTP" that occur at the beginning of a line.
^ | Beginning of string (or beginning of line; see the m option in Regular Expression Options). |
$ | End of string, or before a \n at the end of the string (or end of line; see the m option). |
\A | Beginning of string (ignores the m option). |
\Z | End of string, or before the \n at the end of the string (ignores the m option). |
\z | Exactly the end of the string (ignores the m option). |
\G | Where the current search started (often, this is where the last search ended). |
\b | On a boundary between \w (alpha-numeric) and \W (non alpha-numeric) characters. Returns true at the first and last characters in words separated by spaces. |
\B | Not on a \b boundary. |