Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
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

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 - 24 days ago (Last modified 19 days ago)