# Matches a build version (?!\p{P}) # Do not match if preceeded by punctuation (?\d+) # Match a major version \. # followed by a period (?\d+) # followed by a minor version (?:\.(?\d+))? # followed by an optional build number (?:\.(?\d+))? # followed by an optional build revision.