1878@fishc.com 发表于 2019-7-2 21:31:58

楼上的关于日期的正则
^((({2})(0||))   #闰年,能被4整除但不能被100整除
|((0||)00)   #闰年,能被400整除
-02-29)#匹配闰年2月29日这一天。如果不是这一天,则由下面式子继续匹配验证。
|({3}|{2}{1}|{1}{2}|{3}) #平年(0001-9999)
-(((0|1)-(0||3))   #月日,1、3、5、7、8、10、12月有31天
|((0|11)-(0||30))   #月日,4、6、9、11月有30天
|(02-(0||2)))   #平年2月只有28天,月日表示为【02-01至02-28】

Python初学者2号 发表于 2019-7-31 10:47:58

要用到的时候翻来看看,很有用{:5_108:}

黑色光亮 发表于 2019-9-15 23:50:06

虽然现在晚上11点50了,但是我还是觉得看的很爽哈哈哈

黑色光亮 发表于 2019-9-16 00:02:27

确实当字典来用时比较好的选择,当不会了或者需要了就来查一下

_2_ 发表于 2019-10-2 14:44:09

bencao 发表于 2018-5-2 11:51


特狼噗你好

紫锋 发表于 2019-10-31 01:19:00

买一个来学学{:10_266:}

skyctrl 发表于 2019-11-2 23:43:31

没钱没学习{:5_94:}

liking03 发表于 2019-11-19 16:43:46

占楼,学习~

richardwx008 发表于 2020-2-7 16:38:54

阿萨德

一个账号 发表于 2020-2-9 15:07:56

今天一下子花了 200 多鱼币。

ArmandXiao 发表于 2020-2-25 17:10:49

收藏收藏

lsw945 发表于 2020-3-3 14:34:33

鱼币是啥

luoya120 发表于 2020-5-17 15:35:35

太贵了,买不起了

Tiramisulee 发表于 2020-6-7 08:59:14

没鱼币看啊

油条豆腐脑 发表于 2020-10-28 20:43:38

没有币看不了

lengyue869 发表于 2020-11-7 14:53:02

30鱼B.....是乐至

chenxuaaaaq 发表于 2020-11-27 13:25:25

how can I use regular expression to define if my insert strings is in a format of date.
for example:
import re
pattern = r"(\d)(\d)(\d)"
But I need the first group in the range of 01 to 31, and the second one in the range of 01 to 12. the third one should be in four digitals.

joe0131 发表于 2020-12-6 19:53:19

学习

pythonsean 发表于 2020-12-15 10:26:57

好细,好容易理解,这是真的好

pythonsean 发表于 2020-12-23 14:37:54

看完表示死了1000W个脑细胞。。。。
页: 1 [2] 3
查看完整版本: Python3 如何优雅的使用正则表达式