Zero-width or zero-length assertion in regular expressions means that there is a zero-length match that does not change the current position of the pointer in the input string. These assertions do not consume characters in the string but only assert whether a match is possible or not, giving us a binary true or false match result. Although many zero-width assertions are denoted inside parentheses, like groups, we will soon see that they do not capture any text. Zero-width assertions have no real meaning in back-references or in replacements.
We have already discussed a few zero-width assertions in the previous chapters, such as anchors and boundary assertions.
The Java regular expression engine allows many predefined zero-width assertions, including the ones we have discussed already, such as start, end anchors, and word boundaries.