LogoPixi’VN
pixi-jsFunctions

Function: extractSvgUrlId()

> extractSvgUrlId(url): string

Defined in: node_modules/pixi.js/lib/scene/graphics/shared/svg/utils/extractSvgUrlId.d.ts:23

Internal

Extracts the ID from an SVG url() reference.

This function handles all valid SVG url() formats including:

  • url(#id)
  • url('#id')
  • url("#id")
  • url( #id )
  • url( '#id' )
  • url( "#id" )

The regex pattern matches:

  • url followed by optional whitespace
  • opening parenthesis followed by optional whitespace
  • optional single or double quotes with optional whitespace
  • followed by the ID (any chars except quotes, whitespace, or closing paren)

  • optional single or double quotes with optional whitespace
  • closing parenthesis

Parameters

url

string

The SVG url() string to parse

Returns

string

The extracted ID string, or empty string if no valid ID found