mardi 29 novembre 2016

HTML - Pattern to validate nomenclature

I'm trying to use the "pattern" attribute for HTML5 but I do not have much experience in the regex.

The nomenclature that I wish to validate is the following:

0100455_LM_Izaguirre

Where "0100455" will generally have 7 to 10 characters, "LM" may vary "LM, LI, AQ" and everything that comes after (eg "Izaguirre") is a text with at least 1 character. What is important is that scripts are maintained and needed.

All this is necessary to validate a value that will then be modified in PHP and will later be pasted into a Word with PHPWord.

//0100455_LM_Izaguirre
$sitebase = "0100455_LM_Izaguirre";
$string = explode("_", $sitebase);
$idcontrol = $string[1].'_'.$string[0];

Aucun commentaire:

Enregistrer un commentaire