mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-06 06:43:47 +00:00
Initial commit
This commit is contained in:
parent
bc96ccb183
commit
18f89e91d4
62 changed files with 1661 additions and 2 deletions
15
vs4win/Chapter06/PacktLibrary/StringExtensions.cs
Normal file
15
vs4win/Chapter06/PacktLibrary/StringExtensions.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System.Text.RegularExpressions; // to get Regex
|
||||
|
||||
namespace Packt.Shared;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static bool IsValidEmail(this string input)
|
||||
{
|
||||
// use a simple regular expression to check
|
||||
// that the input string is a valid email
|
||||
|
||||
return Regex.IsMatch(input,
|
||||
@"[a-zA-Z0-9\.-_]+@[a-zA-Z0-9\.-_]+");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue