Skip to main content

Posts

Showing posts with the label Validations

.Net C# match a UK postcode with a regular expression

UK postcode Validation in C# [ RegularExpression (@" ^(([a-zA-Z]{1,2}[0-9][A-Z0-9]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?[0-9][a-zA-Z]{2}|BFPO ?[0-9]{1,4}|(KY[0-9]|MSR|VG|AI)[ -]?[0-9]{4}|[a-zA-Z]{2} ?[0-9]{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$ ", ErrorMessage = "Invalid Post Code.")] public string PostCode { get; set; } Refer -  https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom

Date and Time Formatting in JavaScript like .NET C# or VB.NET

Custom Date and Time formatting in JavaScript like in .NET C# or VB.NET Introduction A date and time format  string  defines the text representation of a  Date()  object, that results in a custom format  string . Any  string  that is not a standard date and time format  string  is interpreted as a custom date and time format  string . You can download the  format.date  JavaScript Utility, an application that enables you to apply format  string s to date and time values and displays the result in  string  format. Background In formatting operations, custom date and time format  string s  can be used with the format method of a  Date()  instance . The format method requires that an input string conforms exactly to a particular pattern for the parse operation to succeed, otherwise it will give you an error ( e.g. ERROR: Not supported method [method name] ). The following table d...