Regex string matched failure -
i not understand how regex string matching works
r2 = r'a[bcd]*b' m1 = re.findall(r2,"abcbd") abcb
this falls in line explained in regex
step 3 engine tries match b, current position @ end of string, fails.
how?i not understand this?
your regular expression requires match end in b
, therefore matched trailing d
. if b
optional, in a[bcd]*b?
, entire string matched.
Comments
Post a Comment