Given the regular expression ABCAB find all the matching pat
Given the regular expression: ^[ABC][^AB]$ find all the matching patterns (could be more than one):
a) A
b) AB
c) ADBC
d) D
e) None
Solution
^ : Starting position in a string.
[] : Matches a single character that is contained within the brackets
^[ABC] : Starting position should contain \'A\' or \'B\' or \'C\'
[^ ] : Matches a single character that is not within the characters contained in brackets
$: Matches ending position of string
[^AB]$ : Ending position of character should not be in \'A\' or \'B\'
Hence
A is not a match because reg exp requires 2 characters
D is also eliminated
ADBC is also because required length is 2
AB is not a valid match because last character hould not be in A or B
Hence the answer is None
![Given the regular expression: ^[ABC][^AB]$ find all the matching patterns (could be more than one): a) A b) AB c) ADBC d) D e) NoneSolution^ : Starting position Given the regular expression: ^[ABC][^AB]$ find all the matching patterns (could be more than one): a) A b) AB c) ADBC d) D e) NoneSolution^ : Starting position](/WebImages/5/given-the-regular-expression-abcab-find-all-the-matching-pat-982314-1761504350-0.webp)