Skip to content

Regex Others

Alternation

Pipe (|)

The pipe | is used to specify alternatives.

For example, the regex pattern cat|dog matches cat or dog.

Escape Character

Escape Character (\)

The backslash \ is used to escape special characters.

For example, the regex pattern \$ matches the dollar sign $.

Delimiters

Caret (^) and Dollar Sign ($)

The caret ^ matches the start of a string, and the dollar sign $ matches the end of a string.

For example, the regex pattern ^hello matches hello at the start of a string.

And the regex pattern world$ matches world at the end of a string.