Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^([A-Z0-9]+[\/])?([A-Z][0-9]|[A-Z]{1,2}|[0-9][A-Z])([0-9]|[0-9]+)([A-Z]+)([\/][A-Z0-9]+)?
/

Description

This REGEX verifies the callsign and splits it up in several parts so it is possible to retrieve the prefix. All additions to the callsign (like /P, /M,..) and prepositions like other DXCC identifier (like DL/ON7BS) will be retrieved. The only DXCC that won't work if found so far is swaziland (prefix 3DA) and I just can't get it to work...

Submitted by anonymous - 5 years ago