Created
May 20, 2020 07:31
-
-
Save kurzweil777/0ed5cd1deca616d6595f36ae9878be11 to your computer and use it in GitHub Desktop.
Regular Expressions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Задание - https://ibb.co/54s5xwy | |
| import re | |
| names = ("Satoshi Nakamoto\n" | |
| "Alice Nakamoto\n" | |
| "RoboCop Nakamoto\n" | |
| "satoshi Nakamoto\n" | |
| "Mr. Nakamoto\n" | |
| "Nakamoto\n" | |
| "Satoshi nakamoto") | |
| namesRegex = re.compile(r'''^[A-Z]\w+\sNakamoto$''', re.MULTILINE) | |
| result = namesRegex.findall(names) | |
| print(result) #['Satoshi Nakamoto', 'Alice Nakamoto', 'RoboCop Nakamoto'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment