How to validate person names? - Python/Django

前端 未结 4 493
清歌不尽
清歌不尽 2021-01-21 13:28

I wish to create a validator for full names for one of my forms.

Unfortunately I am not sure the best way to go on about is, as it is not as trivial as:<

4条回答
  •  情深已故
    2021-01-21 14:15

    I personally wouldn't bother about validating names, I guess there are so many possiblities it is very hard to maintain. If you could come up with a regular expression, I think it would be so generic it wouldn't be effective. The only thing I can think of as valuable is excluding things like @ # $ % ^.

    Just make sure you are escaping characters, if someone's name is Fooalert('lala'), that's fine, but make sure it's not parsed.

提交回复
热议问题