Java Programming
primer-original-v2mediumJava Programming05 Regular Expressionprimer-original-v2

Assume that the ID of an employee should start with "CBE" or "BLR" or "HYD" followed by hyphen (-) followed by 4 digits. Choose the apt regular expression that matches this text.

Answer options

A
(CBE|BLR|HYD)-\d{4}
B
(CBE|BLR|HYD)\d{4}
C
[CBE|BLR|HYD]-\d{4}
D
(CBE|BLR|HYD)-[0-9]+

Correct answer: (CBE|BLR|HYD)-\d{4}

Explanation

Quick AnswerThe correct answer is (CBE|BLR|HYD)-\d{4} because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.