Capture and Name Parts of the Match (抓取和命名匹配中的部分)

来源:互联网 发布:行政服务中心招聘网络 编辑:程序博客网 时间:2024/06/06 20:56

需求1: (命名分组)

2001-02-03


Python:

\d\d(?P<year>\d\d)-(?P<month>\d\d)-(?P<day>\d\d)

Tcl:

regexp -linestop {\d\d(\d\d)-(\d\d)-(\d\d)} $subject sTmp year month day


需求2:(命名分组和前向引用)

2008-08-08


Python: 

\d\d(?P<magic>\d\d)-(?P=magic)-(?P=magic)

0 0
原创粉丝点击