Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
>([0-9]{10})[-<;]\s{1,2}([0-9]{4})([0-9]{5})#(\s([0-9_\?]{0,8}))?(\+\s([a-z0-9_\?]{0,5}))?(\-\s([\.,0-9_\?]{0,10})>)?
/
g

Description

Expression matches magnetic codeline of checks, in italian banking system.

i.e.

>1234567890< 103014250# 66666666+ --> old layout check
>1234567890- 103014250# 66666666+ --> new layout check (notice the '-' check number terminator)

>1234567890< : check number (10 digits plus terminators, required) 103014250#: consists of bank code (4 digits: 1030) and branch code (5 digits: 14250) (both required) 66666666+: account number (optional). Often used to identify different types of checks.

Submitted by Benny - 8 years ago