If the number of subgroups becomes larger, the program will be hard to read due to too many magic numbers.
Therefore, Python provides named groups tricks for sub-content extraction: Instead of using a numbered capturing group, we can use a named group to capture a specific part of the matched string. This can make our code more readable and easier to maintain.
Here’s an example: