IMO not a bug. Backreferences in a statement after 'or' operator are nonsense, because they cannot get something that was not matched by the positive statement before, so they receive 'nothing'.
Look at /(A).*(B)|\2.*\1/ that is "A" followed by anything (except newlines, but including "B") followed by "B" OR 'nothing' (because whole left side failed) followed by anything (except newlines, but including even "A B") followed by 'nothing' (because whole left side failed) As I understand it, there is a difference in what that 'nothing' technically is in certain implementations. Javascript for example seems to consider that 'nothing' as an empty string, so above regexp will match really anything 'x'.match(/(A)|(\1)/)[2] === '' // true [url]http://regexpal.com/?flags=®ex=(A).*(B)|\2.*\1&input=x%20y%3B%20y%20x%3B %20x%20y%3B%20y%20x%20A%20B%20A%20B[/url] -- <http://forum.pspad.com/read.php?4,52425,52472> PSPad freeware editor http://www.pspad.com
