2021年3月13日星期六

Regular expression to find even/odd number

I used codes below to find out even numbers from a string and returned nothing.

could anyone tell me what I missed? Thank you very much.

import re    str2 = "adbv345hj43hvb42"    even_number = re.findall('/^[0-9]*[02468]$/', str2 )  
https://stackoverflow.com/questions/66620639/regular-expression-to-find-even-odd-number March 14, 2021 at 10:51AM

没有评论:

发表评论