[issue25054] Capturing start of line '^'

2015-09-10 Thread Alcolo Alcolo
New submission from Alcolo Alcolo: Why re.findall('^|a', 'a') != ['', 'a'] ? We have: re.findall('^|a', ' a') == ['', 'a'] and re.findall('$|a', ' a') == ['a', ''] Capturing '^' take the 1st character. It's look like a bug ... -- components: Regular Expressions messages: 250364 nosy

[issue25054] Capturing start of line '^'

2015-09-10 Thread Alcolo Alcolo
Alcolo Alcolo added the comment: Naively, I thinked that ^ is be considered as a 0-length token (like $, \b, \B), then after capturing it, we can read the next token : 'a' (for the input string "a"). I use a simple work around: prepending my string with ' ' (because ' ' is neutr