Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
(?P<general>(?P<first>\d{1,3}[\.,']?\d{1,3}?)[xX](?P<second>\d{1,3}[\.,']?\d{1,3}?))
"
gm

Description

Getting sizes, formatted as in <width>x<height> or <height>x<width>. It supports up to 3 digits, with an additional, optional, decimal digit. The decimal point could be a comma, a point or even an apostrophe ( ' ).

Submitted by Hermes - 2 years ago