Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

isValidNIEFormat

elcapo edited this page Oct 16, 2014 · 4 revisions

isValidNIEFormat tests a string against a regexp pattern to see if the string fits the NIE structure.

Usage

/* MySQL */
SELECT isValidNIEFormat( 'X6089822C' ); /* Returns 1 */
SELECT isValidNIEFormat( '1A1A1A1A' ); /* Returns 0 */
/* JavaScript */
var isValid = isValidNIEFormat( 'X6089822C' ); /* Returns 1 */
var isValid = isValidNIEFormat( '1A1A1A1A' ); /* Returns 0 */
/* PHP */
$isValid = isValidNIEFormat( 'X6089822C' ); /* Returns 1 */
$isValid = isValidNIEFormat( '1A1A1A1A' ); /* Returns 0 */

Return values

  • 1 - If the string fits the pattern.
  • 0 - Otherwise.

Dependencies

In order to facilitate the regexp test, this function uses respectsDocPattern.

Category

This function is part of the NIF, NIE & CIF package.

SEPA validations

  • [International Bank Account Numbers (IBAN)](International Bank Account Numbers (IBAN))

Spanish validations

Helpers

  • [Common functions](Common functions)
Clone this wiki locally