Note Matches position at start of string. With the m (multiline) flag, ^ matches the start of each line instead. Do not confuse this with [^...] inside a character class, which means negation.
Note Without the m flag, ^ matches only the very beginning of the entire string. With the m flag, it matches the start of each line (after every newline character).
Frequently asked questions
How does Regular Expressions handle anchor start?
Regular Expressions covers this with 2 copy-ready snippets on this page. The "^ Start of String" snippet in Regular Expressions uses `^pattern`.
Which pattern does the Regular Expressions example use?
The "^ Start of String" snippet uses `^pattern`, from the Basic Patterns section of the Regular Expressions cheat sheet.
What other Regular Expressions snippets are shown for "anchor start"?
Besides "^ Start of String", this page also shows "^ Start Anchor".
Is there anything to watch out for?
Yes. For "^ Start of String": Matches position at start of string. With the m (multiline) flag, ^ matches the start of each line instead. Do not confuse this with [^...] inside a character class, which means negation.