Quantcast
Viewing all articles
Browse latest Browse all 7

Answer by bobince for Documentation for ?: in regex?

PHP's preg_match_all uses the PCRE (Perl-Compatible Regular Expression) syntax, which is documented here. Non-capturing subpatterns are documented in the Subpatterns chapter.

would leave me to believe it has something to do with lookaheads or lookbehinds.

Nope, there are lots of different features which are triggered by open-bracket-question-mark. Lookahead/lookbehind is just the first one you met.

It's messy that many options have to be squeezed into (?, instead of given a more readable syntax of their own, but it was necessary to fit everything into a sequence that was previously not a valid expression in itself, in older variants of regex.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>