NSE4 · Question #14
Which of the following regular expression patterns make the terms "confidential data" case insensitive?
The correct answer is B. /confidential data/i. The correct regular expression pattern to make "confidential data" case insensitive is /confidential data/i, where the 'i' flag outside the forward slashes denotes case insensitivity.
Question
Which of the following regular expression patterns make the terms "confidential data" case insensitive?
Options
- A[confidential data]
- B/confidential data/i
- Ci/confidential data/
- D"confidential data"
How the community answered
(25 responses)- A4% (1)
- B92% (23)
- D4% (1)
Why each option
The correct regular expression pattern to make "confidential data" case insensitive is /confidential data/i, where the 'i' flag outside the forward slashes denotes case insensitivity.
[confidential data] is a character set that would match any single character present within the brackets (c, o, n, f, i, d, e, n, t, i, a, l, space, d, a, t, a), not the entire phrase "confidential data" in a case-insensitive manner.
In regular expressions, the /pattern/i syntax is commonly used, especially in languages like JavaScript, Perl, and FortiGate's implementation, where the 'i' flag appended after the closing slash specifies a case-insensitive match for the preceding pattern.
The syntax i/confidential data/ places the 'i' flag incorrectly before the opening slash, which is not standard regular expression syntax for case insensitivity.
"confidential data" represents a literal string and does not incorporate any regular expression syntax or flag for case-insensitive matching.
Concept tested: Regular expression syntax for case insensitivity
Source: https://docs.fortinet.com/document/fortimanager/7.4.0/handbook/356555/supported-regular-expressions
Topics
Community Discussion
No community discussion yet for this question.