Computer Science · Regular Expressions
A system validates customer IDs of the form AB1234XY (exactly two uppercase letters, followed by four digits, followed by two uppercase letters). Which logic best ensures the required strict format matches?
- 1Check total length = 8 and use contains() for digits
- 2Split the string and validate each part manually
- 3Use regex: ^[A-Z]{2}\d{4}[A-Z]{2}✓
- 4Use substring and compare ASCII values
Correct answer
Use regex: ^[A-Z]{2}\d{4}[A-Z]{2}
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on Regular Expressions?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · Regular Expressions