Regular Expressions 101

Community Patterns

123...6

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