REGEXVAULTv2.0
Finance/Securities & Trading
Verified Safe

Bloomberg Ticker Regex for PHP

/^[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 PHP. 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 PHP project — whether you're validating in a Laravel validator, a WordPress plugin, or a standalone PHP script.

Php Implementation

Php
<?php
// Bloomberg Ticker
// ReDoS-safe | RegexVault — Finance > Securities & Trading

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

function validate_bloomberg_ticker(string $input): bool {
    return (bool) preg_match(BLOOMBERG_TICKER_PATTERN, $input);
}

// Example
var_dump(validate_bloomberg_ticker("AAPL US")); // bool(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 PHP developers because especially relevant in PHP where PCRE backtracking limits can trigger silent failures on malicious input. 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