JavaScript Regular Expression Caret ^

In JavaScript regular expressions, the caret (^) special character can be used in two ways.

First, it can be used as a line anchor, specifying the beginning of a line. I explained this previously in my post JavaScript Regular Expression Special Characters.

Second, it can be used inside a character class to negate the characters being searched for in the character class. Please see my post JavaScript Regular Expression Square Bracket Negation.

Related articles:
JavaScript Regular Expressions

Leave a Reply