Regex ^ — Start of Line/String

^ is a zero-width anchor that matches the start of the input string, or the start of each line when the multiline (/m) flag is set. It consumes no characters.

Open the interactive DevRef Hub tool →

Key facts

Token^
TypeZero-width anchor
With /mMatches each line start
Example/^/ on "hello\nworld" → ["hello"]

Frequently asked questions

What does ^ mean in regex?

It anchors a match to the start of the string (or line with /m).

Does ^ consume characters?

No, it is zero-width and only asserts a position.

Related pages

Regex ^ — Start Anchor is part of DevRef Hub on GOAT Lab — a free reference you can use without signing up, and it works offline. Open the tool above for any custom value.

Advertise

Part of GOAT Lab — 26 free, browser-based science, engineering and developer tools. No sign-up.