Community Patterns

Community Library Entry

1

Regular Expression
Created·2024-10-12 14:39
Updated·2024-10-18 01:40
Flavor·Python

r"
<svg.*?viewBox=\"(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e\d+)?)\s*(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e\d+)?)\s*(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e\d+)?)\s*(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e\d+)?)\".*?>
"
is
Open regex in editor

Description

for finding and extracting numbers from the viewbox attribute. see also my generalized SVG number regex.

  • v2: added support for scientific notation
Submitted by riedler