Which of the following characters matches the start of a line in a regular expression?

Study for the JavaScript Certification Test. Utilizes flashcards and multiple-choice questions; each question includes hints and explanations. Prepare to ace your exam!

In regular expressions, the caret character (^) is used to denote the beginning of a line. When this character is placed at the start of a pattern, it asserts that the subsequent characters must match at the very start of the string or the start of a line in a multiline string. For example, using ^hello would only match "hello" if it is the first word in the string or line.

The other characters mentioned serve different purposes: the dollar sign ($) matches the end of a line, the asterisk (*) is a quantifier that matches zero or more occurrences of the previous character, and the question mark (?) indicates zero or one occurrence of the preceding character. Thus, the correct answer is the caret (^) because it specifically matches the beginning of a line in a regular expression context.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy