I'm trying to understand the difference between \d
and \\d
in regular expression. I have a quiz that I got wrong, please refer this to answer the question as well.
Asked
Active
Viewed 394 times
0

Wiktor Stribiżew
- 607,720
- 39
- 448
- 563

G.Lee159
- 39
- 5
-
1I wouldn't say that this is a dupe of the referenced Q, but I'm sure there's an A explaining it on SA (e.g. https://stackoverflow.com/a/30262198/2064981). The problem is that the RE is defined in a string, and in java ``\`` needs to be escaped in a string, to represent a literal ``\ ``. I.e. answer **a** is wrong. – SamWhan May 16 '18 at 10:12
-
Actually, `b` is also wrong as it requires at least 2 digits after the 2 letters. Flag the question. – Wiktor Stribiżew May 16 '18 at 10:36