Variable: ATTRIBUTE_SELECTOR
ts
const ATTRIBUTE_SELECTOR: Regex<"\\[(?<attr>[\\w-]+)(?:=(?<value>[\"']?[^\\]]*?)(?<quote>[\"'])?)\\?\\]", {
flags: "u";
names: {
attr: string;
quote?: string;
value?: string;
};
}>;Defined in: packages/regex/src/tiers/cssdoc-local.ts:128
Attribute Selector Pattern Matches attribute selector syntax: [attr] or [attr="value"] Used for state and modifier attribute extraction.
Note: Simplified to avoid backreferences for better compatibility.
Example
ts
ATTRIBUTE_SELECTOR.exec("[disabled]")?.groups // { attr: "disabled" }
ATTRIBUTE_SELECTOR.exec("[aria-expanded=true]")?.groups // { attr: "aria-expanded", value: "true" }