nerdexam
Splunk

SPLK-1004 · Question #45

SPLK-1004 Question #45: Real Exam Question with Answer & Explanation

The correct answer is B. Avoid backtracking.. In regex (regular expressions), one of the best practices is to avoid backtracking when possible. Backtracking occurs when the regex engine revisits previous parts of the input string to attempt different permutations of the pattern, which can significantly degrade performance, e

Question

Which is a regex best practice?

Options

  • AUse complex expressions rather than simple ones.
  • BAvoid backtracking.
  • CUse greedy operators (. *) instead of non-greedy operators (. *? ).
  • DUse * rather than +.

Explanation

In regex (regular expressions), one of the best practices is to avoid backtracking when possible. Backtracking occurs when the regex engine revisits previous parts of the input string to attempt different permutations of the pattern, which can significantly degrade performance, especially with complex patterns on large inputs. Designing regex patterns to minimize or avoid backtracking can lead to more efficient and faster evaluations.

Community Discussion

No community discussion yet for this question.

Full SPLK-1004 Practice