For instance, you have the following pattern r'([Dd]ogs?)|([Cc]ats])'and the following string 'Dogs are the best!'. As you can see the string matches only the first group of the regexp pattern. What happens if you pass the groups()method on the result?
Groups and alternations
Is it a problem?
Report a typo
Select one option from the list
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.