Spec? or Bug?
Javascript and Ruby have behavior "Match starting pointer proceed one step after the zero-width match". it does not make problems in the majority of implementation probably. However, I think personally that it is close to the bug, because can not use intuitive implementation such as simple match pattern /^|(Abc)/.
I have not yet understood that about OR conditions behavior of PHP and Javascript|Ruby either is correct in compliance with the standards. Not defined in the standard, or programming language implementation mistakes, PHP are dealing with their own implementation, etc. it could be a variety of causes.
Standards of typical regular expression
- POSIX BRE (Basic Regular Expression)
- POSIX ERE (Extended Reuglar Exression)
- ECMAScript
It is likely to be discovered by examining the standards of POSIX and ECMAScript, but I am pending it because it will take long time. When I get the cause, I will report it to organizations that are implementing Javascipt and Ruby.
Javascript (ECMAScript5) is in the development of ECMAScript6. At the timing at which the major browser corresponding to ECMAScript6, we will re-investigate this matter.