how to allow characters, space and dot in regular expression?

前端 未结 3 515
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 06:32
ValidationExpression=\"^[a-zA-Z ]+$\"

this is my current regular expression but it does not accept .(dot). I need to use it for names. like \"R

3条回答
  •  遥遥无期
    2021-01-26 06:59

    The following expression gets all

    • characters (a-zA-Z)
    • whitespaces (\s) and
    • dots (\.)

    between the string beginning (^) and end ($):

    The '@' is necessary to quote the backslashes inside the string.

    ValidationExpression=@"^[a-zA-Z\s\.]+$"
    

提交回复
热议问题