model rules validation for name and surname

Hi everyone,

I would know if there is a pattern for name and surname rule validation.

However "my rules" are these:

name: every letter from [a-Z], [A-Z], every letter with accents, " ", “’”, “.”, “?”, “-”, “(”, “)”

surname: every letter from [a-Z], [A-Z], every letter with accents, " ", “’”, “.”, “?”, “-”

surname (2nd version) : like previous with ","

Anyone can help me with patterns?

Thanks a lot!

Nothing?

Is this what you need?

http://www.yiiframework.com/doc/api/1.1/CRegularExpressionValidator

Can you help me with my reg expression?

The name field can include

  • every letter from [a-z] and [A-Z]

  • every special alphabetic char like è, ç, ü, ß, etc

  • these chars:


" "


'


.


?


-


(


)

Thanks

No, sorry, you might want to ask in a general PHP forum or on SO for that.

Start with this example

http://www.yiiframework.com/doc/api/1.1/CRegularExpressionValidator#c3090

Things to consider:

  • Save the code as UTF-8

  • Escape reserved characters with backslash