1.

What is the most essential purpose of parentheses in regular expressions?(a) Define pattern matching techniques(b) Define subpatterns within the complete pattern(c) Define portion of strings in the regular expression(d) matching the complete stringThis question was addressed to me during an interview.I want to ask this question from Pattern Matching and Regular Expressions topic in portion Classes and Modules in JavaScript of JavaScript

Answer»

The correct option is (b) Define subpatterns within the COMPLETE pattern

The BEST explanation: When a REGULAR expression is successfully matched against a target STRING, it is possible to extract the portions of the target string that matched any particular paranthesized subpattern. The essential PURPOSE of parantheses in regular expressions is to define subpatterns within the complete pattern.



Discussion

No Comment Found

Related InterviewSolutions