What is the regular expression to match a digit (0-9) in a string?
Answer options
A
\d
B
[0-9]
C
\D
D
[^0-9]
Correct answer: \d
Explanation
Quick AnswerThe correct answer is \d because it directly addresses the core logic of Java Programming.
\d matches any digit character (0–9) in Java regex.