Bloomberg Ticker Regex for JavaScript
/^[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 JavaScript. 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 JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.
Javascript Implementation
// Bloomberg Ticker
// ReDoS-safe | RegexVault — Finance > Securities & Trading
const bloombergTickerRegex = /^[A-Z0-9]{1,12}(?:[:\/]\s?[A-Z0-9]{1,2}|(?:\s[A-Z]{2}))(?:\s(?:Equity|Corp|Index|Curncy|Comdty))?$/;
function validateBloombergTicker(input: string): boolean {
return bloombergTickerRegex.test(input);
}
// Example
console.log(validateBloombergTicker("AAPL US")); // trueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
AAPL US | AAPL |
AAPL:US | aapl US |
TSLA US Equity | AAPL:USA |
BP/ LN | AAPL 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 JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. 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