Vidyalelo
JavaScript · Q36

Classes And Modules

Programming · JavaScript · question 36

Q36

What is the most essential purpose of parantheses in regular expressions ?

A.
Define pattern matching techniques
B.
Define subpatterns within the complete pattern
Answer
C.
Define portion of strings in the regular expression
D.
All of the mentioned

Answer: Option B

Solution

Answer: Option B
Solution:
When a regular expression is successfullyy 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.