Antwort #6 am: 07. Mai 2015, 08:50:28
Vielen Dank, genau das, was ich gerade brauche. In meinem Falle wäre es allerdings das Telefonnummern-Feld, das Name-Feld werde ich bei dieser Gelegenheit gleich mit zum Pflichtfeld machen.
In diesem Zusammenhang: Eine Validierung der Telefonnummer wäre nett.
Hier habe ich dazu was gefunden:
bzw.
Vielleicht ist hier aber eine etwas komplexere Expression angebracht:
$telephone = preg_replace('/^(([^\.\-\,a-wy-z]([\(]?(\+|[x])?\d+[\)]?)?[\s\.\-\,]?([\(]?\d+[\)]?)?[\s\.\-\,]?(\d+[\s\.\-\,]?)+[^\.\-\,a-z])|((\+|[x])?\d+))$/i', '', $telephone); Quelle:
hier.
Sollte die meisten Schreibweisen (Klammern, 0049, +49, Punkte, etc.) internationaler Nummern abdecken. Mir fehlt hier eigentlich nur noch der Schrägstrich, so würde z.B. ich eine Vorwahl von der Nummer trennen. Leider habe ich es nicht so mit regex, kann da mal jemand drüber schauen und mir das ggf. verbessern?
Schon mal besten Dank im Voraus