To specify a string that starts or ends a line, use the ^ (carat) or $ (dollar) characters. Using both ^ and $, you can also specify a string that makes up an entire line—start to end.
- Start of line anchor: ^(string)
- End of line anchor: (string)$
| Pattern | Description |
|---|---|
| ^Hi | The first word of a line must be "Hi". |
| bye$ | The last word of a line must be "bye". |
| ^Hacked by J03$ | "Hacked by J03" forms an entire line. |