Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?P<cusip>(\d{3}[a-zA-Z0-9]{6}|\d{3}[a-zA-Z0-9]{5}))(\s*([:-]?\s*))(?P<price>((\$)?\s{0,2}\d{2,3})((?=\s)|(\.\d+)|(\-(([0-2]\d)|(3[0-2])))))
/
g

Description

SHould pickup a cusip followed by a price in decimals or ticks.

Submitted by Rohit Thapliyal - 9 years ago