Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(?<s1>\d)(?<n>[^~]*)(~(?<a1>\d*)?(~(?<s2>\d)~(?<a2>.+))?)?$
/
gm

Description

ФИАС 2:ГАР
Regex101

ESTSTAT - статус дома
STRSTAT - статус строения
[ESTSTAT]{[Номер]}{~{[Корпус]}{~[STRSTAT]~[Номер]}}

^(?<s1>\d)(?<n>[^~]*)(~(?<a1>\d*)?(~(?<s2>\d)~(?<a2>.+))?)?$
^(?<s1>\d)(?<n>[\dа-яА-Я]*)(~(?<a1>\d*)?(~(?<s2>\d)~(?<a2>.+))?)?$

Примеры:

142у~72~3~Г7
0~~1~1
542У~~1~2
142~1
142
Submitted by Virenbar - 3 years ago