I have a python code like below: My question is why the matched variable is [\' \']? (I used the regex in regexpal.com, it can find the right result |Name=A. Johnson | there)
Looks to be how it's handling grouping. As a simpler example, look at the difference between the output of the following lines of code:
re.findall("c(a)*t", "hi caaat hi")
re.findall("c(a*)t", "hi caaat hi")
It looks like the code you want would be more like:
re.findall("\|\s*name\s*=([^\|\}]*)", a, re.I)