We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
\d+ means one or more digits, while you need to match exactly 2, 2 and 4 digits respectively here. \d{2} means: match exactly 2 digits. This notation makes your regex more readable than \d\d in my opinion.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matching Digits & Non-Digit Characters
You are viewing a single comment's thread. Return to all comments →
\d+ means one or more digits, while you need to match exactly 2, 2 and 4 digits respectively here. \d{2} means: match exactly 2 digits. This notation makes your regex more readable than \d\d in my opinion.