0

How can i use named group? What is the scenaria?

How can i use named group? What is the scenaria?

4th Oct 2017, 11:52 AM
Liang Zhang
Liang Zhang - avatar
1 ответ
0
In the group lesson there is a good example: "import re pattern = r"(?P<first>abc)(?:def)(ghi)" match = re.match(pattern, "abcdefghi") if match: print(match.group("first")) print(match.groups())" here "first" is the name of the group so if match you can get the expresion of that group!
10th Jun 2018, 6:00 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar