validCashtag top-level constant
String
const validCashtag
A cashtag is a $ prefixed ticker-like symbol composed of ASCII letters
optionally followed by additional ASCII letters or digits.
Examples that match: $AAPL, $tsla, $BRK1, $GME.
Examples that do NOT match: $1, $-AAPL, $$AAPL, $AAPL$BB.
The pattern intentionally mirrors the spirit of validHashtag regarding boundary detection but constrains the body to ticker-like symbols, which is the de-facto convention for cashtags.
Implementation
const validCashtag =
'($cashtagBoundary)'
'($cashSigns)'
r'([A-Za-z][A-Za-z0-9]*)'
r'(?![A-Za-z0-9])';