Regular Expressions 101

Community Patterns

Bloomberg Futures

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 - 8 years ago