PHP regex para nombres [cerrado]

Am Searching about Regex syntax that accept only A-Z a-z till 25 letters only with spaces. Can you help me ?

preguntado el 31 de enero de 12 a las 16:01

What have you tried so far? What exactly do you have problems with? It seems to be a rather basic expression, you should find all the information you need on regular-expressions.info. -

Note that what you describe is not a very good regex to validate names. -

Yeah it is a basic problem. But i know everything related to programming except these one .. ! -

Regarding to business requirement it is the desired rule to validate the names .. -

You're going to make Céline O'Brien-Röhm very sad. -

2 Respuestas

/^[a-z ]{0,25}$/i

It matches case-insensitive a-z and spaces 0 - 25 times

Respondido el 31 de enero de 12 a las 20:01

so can u explain this for me in more details ? - Hatem

Yeah it is not working with me! - Hatem

@Hatem Everything is explained. - TimWolla

Many thanx it is the desired one :) - Hatem

Puedes hacerlo:

$string = preg_match('/[a-z ]{0,25}/i', $string);

This will match a to z and spaces 0 to 25 times.

Respondido el 31 de enero de 12 a las 20:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.