Skip to content

[Bug]: Support for ISO 9362:2022 BIC (SWIFT) codes #1471

@fira42073

Description

@fira42073

Problem
The built-in bic validator currently appears to reject some valid BICs introduced under the ISO 9362:2022 revision — specifically those where the first four characters of the party prefix can include digits (e.g. E097AEXX).

This pattern is valid per ISO 9362:2022, section 6.3.1, which allows the party prefix to be alphanumeric, not just letters.

Example

type Bank struct {
    SwiftCode string `validate:"bic"`
}

bank := Bank{SwiftCode: "E097AEXX"} // Valid under ISO 9362:2022
err := validate.Struct(bank)

Currently, this fails validation with the built-in bic tag.

Expected behavior
The bic tag should validate codes conforming to both:
ISO 9362:2014 (legacy 8- or 11-char codes), and
ISO 9362:2022 (new alphanumeric party prefix).

References
ISO 9362:2022 (Business Identifier Code)
Example real-world BIC: E097AEXX
Related discussion: Symfony issue 51975

I'm willing to contribute here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions