正则表达式是正确的名字和姓氏或仅对于Asp.net的名字 [英] Regular Expression is correct First and Last name or only For First name For Asp.net

查看:58
本文介绍了正则表达式是正确的名字和姓氏或仅对于Asp.net的名字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的正则表达式,我已经写了^([A-z][A-Za-z]*\s*[A-Za-z]*)$这个名字和空白(空格)姓氏.
名字叫Will always Capital.
以下输入数示例正确

I am new Regular Expression i have write ^([A-z][A-Za-z]*\s*[A-Za-z]*)$ this for first name and as number of white space(space) lastname.
First name is Will always Capital.
It is correct fo Example following number of input

1. Xyz  dfg  
2.Fgd   fgg 

将只能输入名字的输入.
1.Xyz
仅姓氏会输入什么\ s?
我为Asp.net文本框创建正则表达式验证

Will can write input only for first name.
1.Xyz
What \s will only first name will take input ????
I creating for Asp.net Textbox Regular Expression Validation

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
              <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                  ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator"
                  ValidationExpression="^([A-z][A-Za-z]*\s*[A-Za-z]*)$"></asp:RegularExpressionValidator>

推荐答案

这是名字和空白(空格)姓氏的编号.
名字叫Will always Capital.
以下输入数示例正确
this for first name and as number of white space(space) lastname.
First name is Will always Capital.
It is correct fo Example following number of input
1. Xyz  dfg  
2.Fgd   fgg 

将只能输入名字的输入.
1.Xyz
仅姓氏会输入什么\ s?
我为Asp.net文本框创建正则表达式验证

Will can write input only for first name.
1.Xyz
What \s will only first name will take input ????
I creating for Asp.net Textbox Regular Expression Validation

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
              <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                  ControlToValidate="TextBox1" ErrorMessage="RegularExpressionValidator"
                  ValidationExpression="^([A-z][A-Za-z]*\s*[A-Za-z]*)


" < /asp:RegularExpressionValidator >


尝试以下操作:
Try this instead:
^([A-z][A-Za-z]*\s+[A-Za-z]*)|([A-z][A-Za-z]*)


这篇关于正则表达式是正确的名字和姓氏或仅对于Asp.net的名字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆