Download presentation
Presentation is loading. Please wait.
1
Example: Checking for correct UK Postcode
PostCodeTextBox CheckButton private void CheckButton_Click(object sender, EventArgs e) { if (Regex.IsMatch(PostCodeTextBox.Text, "^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKPS-UW]) {0,1}[0-9][ABD-HJLNP-UW-Z]{2})$")) errorProvider1.SetError(PostCodeTextBox , String.Empty); } else errorProvider1.SetError(PostCodeTextBox, "Not a UK postcode!\nTry again."); Where does this string monster come from? Just google: c# regex uk post code (or whatever you are looking for)
2
RegEx References The RegEx Cheat Sheet can be found here
The official Microsoft reference is here A tutorial can be found here
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.