Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?:(.*)([FGHJKMNQUVXZ])(\d{1,2})|(.*[^\d])(\d{1,2}))\s(\w*)
/

Description

Separates generic and individual bloomberg symbols into 'root', 'month' (or lack of it), 'year' or 'generic contract number' and 'yellow key'

Problem is that matches for root are 1 and 4, can't give them save reference or number. Will update if figure out

Submitted by @TradingMax - 9 years ago