Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(.*) ([\w\d\.\-\(\)]+) (\d(?:\.\d+){2,}$)
/
gm

Description

OIDs are just numbers in the format 1.2.3.4.5.6.7.8.9... Short names are alphanumeric, contiguous descriptions (no spaces, hyphens allowed) Long names can be basically everything (sometimes even UTF-8!)

Sometimes, organisations providing the list of 'their' OIDs might reverse the order, for listing a directory reference (look up the name, then figure out what OID it is being assigned to). This regexp captures this 'reverse directory' scheme and rewrites everything properly for OpenSSL.

Submitted by Gwyneth Llewelyn - 2 years ago