350-501 · Question #91
Which regular expression query modifier function indicates the start of a string?
The correct answer is A. ^. In regular expressions, the caret '^' symbol is used as an anchor to match the beginning of a string.
Question
Which regular expression query modifier function indicates the start of a string?
Options
- A^
- B[^]
- C
- D$
How the community answered
(18 responses)- A89% (16)
- B6% (1)
- C6% (1)
Why each option
In regular expressions, the caret '^' symbol is used as an anchor to match the beginning of a string.
The caret '^' symbol is a special character in regular expressions that asserts the position at the start of the string or the start of a line, depending on the regex engine's mode.
`[^]` denotes a negated character set, meaning it matches any character that is NOT inside the brackets. It does not indicate the start of a string.
The plus sign `+` is a quantifier that matches one or more occurrences of the preceding character or group. It does not indicate the start of a string.
The dollar sign `$` is an anchor that matches the end of a string or the end of a line, not the start.
Concept tested: Regular expression anchors
Source: https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/12_4t/12_4t_book/ip_regexp.html
Topics
Community Discussion
No community discussion yet for this question.