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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -