Hi, I am trying to learn and understand look arounds, In the code below why is '1' removed and not !123!
I was using IDLE to run the code
Actually this is a better example of a positive look behind
a = "learn@123Python456" re.findall(r"\d+", a) #['123', '456'] re.findall(r"(?<!\W)\d+", a) #['23', '456']while if I use a positive look behind such as:
b = "@@@coding????isfun" re.findall(r"\w+", b) #['coding', 'isfun'] re.findall(r"(?<=\W)\w+", b) #['coding', 'isfun']All the characters are retained
I was using IDLE to run the code
Actually this is a better example of a positive look behind
b = "@@@coding isfun" re.findall(r"\w+", b) #['coding', 'isfun'] re.findall(r"(?<=\s)\w+", b) #['isfun']any assistance will be appreciated, thanks