c# - Check the textbox contains any characters and numbers -


I want the text to include characters after numbers in the text box entered by the user. Example: A1001 I have already got a solution using Regex and if the error box does not contain characters after the number in the text box, but once I have entered the text "A1" in the text box, error The message box still appears.

Here is the code I am using:

  Zero Button 1_Click (Object Sender, EventArgs e) {ifge! (Regex.IsMatch (this.textBox1 .Text, @ "(a-zA-Z)")) {SystemManager.ShowMessageBox ("Please enter the characters after the characters for the product code. \ NExample: A1001", "Notice", 2); } Else if (! Regex.IsMatch (this.textbox1.Text, @ "(0-9)")) {SystemManager.ShowMessageBox ("Please enter the letters after the numbers for the product code. \ N Example: A - 1001 "," Notice ", 2); }}  

Your answer greatly appreciated!

Thanks

  ^ [a-zA-Z] + \ D + $  

Try it out. This a regex will validate your terms. See the demo.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -