?: is used when you want to group an expression, but you do not want to save it as a matched/captured portion of the string. An example would be something to match an IP address: (?:\d{1,3}\.){3}\d{1,3} Note that I don't care about saving the first 3 octets, but the (?:...) grouping allows me to shorten the regex without incurring the overhead of capturing and storing a match.