REGEXVAULTv2.0
Finance/Securities & Trading
Verified Safe

Bloomberg Ticker Regex for Python

/^[A-Z0-9]{1,12}(?:[:/]\s?[A-Z0-9]{1,2}|(?:\s[A-Z]{2}))(?:\s(?:Equity|Corp|Index|Curncy|Comdty))?$/

What this pattern does

This page provides a comprehensive, battle-tested regular expression for matching bloomberg ticker, ported and verified for Python. Financial data validation has zero tolerance for false negatives — a missed invalid entry can corrupt downstream calculations. The snippet below is ready to drop into your Python project — whether you're validating in a Django view, a FastAPI endpoint, or a standalone data processing script.

Python Implementation

Python
# Bloomberg Ticker
# ReDoS-safe | RegexVault — Finance > Securities & Trading

import re

bloomberg_ticker_pattern = re.compile(r'^[A-Z0-9]{1,12}(?:[:/]\s?[A-Z0-9]{1,2}|(?:\s[A-Z]{2}))(?:\s(?:Equity|Corp|Index|Curncy|Comdty))?$')

def validate_bloomberg_ticker(value: str) -> bool:
    return bool(bloomberg_ticker_pattern.fullmatch(value))

# Example
print(validate_bloomberg_ticker("AAPL US"))  # True

Test Cases

Matches (Valid)
Rejects (Invalid)
AAPL USAAPL
AAPL:USaapl US
TSLA US EquityAAPL:USA
BP/ LNAAPL US EQUITY lowercase
7203 JP

When to use this pattern

This pattern is drawn from the Finance > Securities & Trading category and carries a ReDoS-safe certification. That matters for Python developers because particularly important in Python web servers where CPU-bound regex operations can stall concurrent request handling. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.

Common Pitfalls

Bloomberg tickers are proprietary. Different terminals may display the same security with slightly different ticker formatting. Do not use Bloomberg tickers as primary identifiers — use ISIN or FIGI.

Technical Notes

Bloomberg format: security identifier + exchange/country code + optional asset class (Equity, Comdty, Corp, Govt, Curncy). This pattern matches the ticker+exchange portion. Full Bloomberg parsing requires the asset class suffix.

Have a pattern that belongs in the vault?

Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.

Submit a Pattern