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.
the first parentheses-delimited expression inside of the regex.
It will return the number of alternate matching pattern which should be at max 1. SO the condition is of <2.
re.findall function will take a pattern and a string. So we matches the digit \d.
(?=...)
Matches if ... matches next, but doesn’t consume any of the string. This is called a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if it’s followed by 'Asimov'.
Hope it helps.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Postal Codes
You are viewing a single comment's thread. Return to all comments →
the first parentheses-delimited expression inside of the regex. It will return the number of alternate matching pattern which should be at max 1. SO the condition is of <2. re.findall function will take a pattern and a string. So we matches the digit \d. (?=...) Matches if ... matches next, but doesn’t consume any of the string. This is called a lookahead assertion. For example, Isaac (?=Asimov) will match 'Isaac ' only if it’s followed by 'Asimov'.
Hope it helps.