我不是正則表達式的專家,但我從頭開始做了這個,我只需要基於這個獲取數字和字母 [ae] :
SnnEnn where n represent numbers
SnnEnnl where l = letter [a-e]
nnXnn where n represent numbers
nnXnnl where l = letter [a-e]
但在少數情況下會失敗:
02x01 match '02x01' fail (It should be '02' '01')
03x02a match '03x02'..............groups 'a' fail (It should be '03' '02' 'a')
S03E01 match 'S03E01'.............groups '03' '01' ok
S03E01a match 'S03E01a'............groups 'S03E01' 'a' fail.(It should be '03' '01' 'a')
03x02xxxx match '03X02xxxx' groups '03x02xxxx' fail (it should be just [a-e] and limit to one letter)
S03E01xxx match '03E01xxxx' groups '03e01xxxx' fail (idem)
我正在使用這個正則表達式:
(\d+[x]\d+\w)([a-e])|(\d+[x]\w+)|\bS(?P<Season>\d+)E(?P<Episode>\d+)|(\b[s]\d+[e]\d+)([a-e])
感謝您的任何幫助
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句