What does this Django regular expression mean? `?P`

前端 未结 5 618
长情又很酷
长情又很酷 2021-01-30 00:46

I have the following regular expression (regex) in my urls.py and I\'d like to know what it means. Specifically the (?P portion o

5条回答
  •  萌比男神i
    2021-01-30 01:32

    (?Pregex) - Round brackets group the regex between them. They capture the text matched by the regex inside them that can be referenced by the name between the sharp brackets. The name may consist of letters and digits.

    Copy paste from: http://www.regular-expressions.info/refext.html

提交回复
热议问题