If, like me, you tend to use the /U pattern modifier, then you will need to remember that using ? or * to to test for optional characters will match zero characters if it means that the rest of the pattern can continue matching, even if the optional characters exist. For instance, if we have this string: a___bcde and apply this pattern: '/a(_*).*e/U' The whole pattern is matched but none of the _