Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


Regular Expression

Validate an email address using regular expressions


Validate an email address using regular expressions

email address are the means of communication with people around the world. While processing forms email address validation plays an important. Proper email validation strengthen our contact list, ban spamming and protect us from robot form filling (Form AutoFill).

Here we are going to design a regular expression pattern to validate email address. which will check to make sure an e-mail address is a valid address, and in proper format means containing an username, at sign (@), and valid hostname. For example, admin@samplehost.com is valid, but SPAM@badhost is invalid. Most of email service provides limit the use of literals for email address creation. Only letters (a-z,A-Z), numbers (0-9), hyphens (-), underscore (_) and periods (.) are allowed and no special characters are accepted. You can add or remove any literals to your regular expression.

Regular Expression Pattern

^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$
 
email with IP -
^([a-zA-Z0-9_\-\.]+)@(([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))|(([01]?\d\d?|2[0-4]\d|25[0-5])\.){3}([01]?\d\d?|25[0-5]|2[0-4]\d))$

For more information on Regular Expressions IP Address Validation with .net


Read the rest of this entry »

Regular Expressions IP Address Validation with .net


Regular Expressions IP Address Validation with .net

An Internet Protocol (IP) address is a numerical identification (logical address) that is assigned to devices participating in a computer network utilizing the Internet Protocol for communication between its nodes.

IP Address Classes:

IP addresses are categories into five classes: Class A, Class B, Class C, Class D and Class E. Each class allows for a range of valid IP addresses. whereas classes A, B and C are used to communication.

Class A Internet Protocol (IP) address ranges include 1.0.0.0 to 126.255.255.255. This class supports 16 million hosts on each of the 127 networks. network 0.0.0.0 is reserved for use as the default route and the network 127.0.0.0 is reserved for the “loopback” function.

Class B Internet Protocol (IP) address ranges include 128.1.0.0 to 191.255.255.255. This class supports 65,000 hosts on each of the 16,000 networks.

Class D Internet Protocol (IP) address ranges include 224.0.0.0 to 239.255.255.255. This class is used to support multicasting.

Class E Internet Protocol (IP) address ranges include 240.0.0.0 to 254.255.255.254. This class is used for experimentation. Class E networks have never been documented or utilized in a standard way.

IP addresses are also commonly used to divide networks into smaller ones. This concept is called subnetting. Subnet addresses include 255.0.0.0 to 255.255.255.255

Dotted-Decimal Notation

To make Internet addresses easier for people to read and write, IP addresses are often expressed as four decimal numbers, each separated by a dot. This format is called “dotted-decimal notation.” Dotted-decimal notation divides the 32-bit Internet address into four 8- bit fields and specifies the value of each field independently as a decimal number with the fields separated by dots.

Regular Expression Pattern

^(([01]?\d\d?|2[0-4]\d|25[0-5])\.){3}([01]?\d\d?|25[0-5]|2[0-4]\d)$


Read the rest of this entry »

Regular Expressions with .net – U.S. Social Security Numbers


Regular Expressions with .net – U.S. Social Security Numbers

In the United States, a Social Security number (abbreviated as SSN) is a nine-digit number issued to U.S. citizens, permanent residents, and temporary (working) residents. U.S. social security numbers are three sets of digits separated by hyphens; the first set contains three digits, the second set contains two digits, and the third set contains four digits. Its primary purpose is to track individuals for taxation purposes. In recent years the SSN has become a de facto national identification number. A properly formatted US social security number. first three digits must be 001 – 772.

Regular Expression Pattern

^((?!000)([0-6]\d{2}|[0-7]{2}[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$

A description of the regular expression:

[1]: A numbered capture group. [(?!000)([0-6]\d{2}|[0-7]{2}[0-2])]
(?!000)([0-6]\d{2}|[0-7]{2}[0-2])
Match if suffix is absent. [000]
[2]: A numbered capture group. [[0-6]\d{2}|[0-7]{2}[0-2]]
Select from 2 alternatives
[0-6]\d{2}
Any character in this class: [0-6]
Any digit, exactly 2 repetitions
[0-7]{2}[0-2]
Any character in this class: [0-7], exactly 2 repetitions
Any character in this class: [0-2]
-
[3]: A numbered capture group. [(?!00)\d{2}]
(?!00)\d{2}
Match if suffix is absent. [00]
Any digit, exactly 2 repetitions
-
[4]: A numbered capture group. [(?!0000)\d{4}]
(?!0000)\d{4}
Match if suffix is absent. [0000]
Any digit, exactly 4 repetitions


Read the rest of this entry »

Understanding Regular Expressions metacharacters with uses


Understanding Regular Expressions metacharacters with uses

The ^ (caret) metacharacter – Start of a string

^ (caret) metacharacter matches the characters that occur immediately after the beginning of a line or string.

Suppose we want to search "we"
Text Pattern is – we have holiday on wednesday

It will match the sequence of characters "we" in the words we, and wednesday. However, the same pattern preceded by the ^ metacharacter means "^we" when applied to the same Text Pattern. It will match the sequence of characters "we" occurs immediately after the start of the string.

The $ (dollar) metacharacter – End of a string

$ (dollar) metacharacter matches the characters that immediately precede the end of a line or string.

Suppose we want to search "day"
Text Pattern is – Today we have office but we have holiday on wednesday

It will match the sequence of characters "day" in the words Today, holiday and wednesday. However, the same pattern processed with the $ metacharacter means "day$" when applied to the same Text Pattern. It will match the sequence of characters "day" occurs at the end of a line in the words wednesday.


Read the rest of this entry »

Matching text with Special meta-characters using Regular Expressions


Matching text with Special meta-characters using Regular Expressions

Regex are more powerful and we want to do more than simply search for literal pieces of text. There are certain reserved meta-characters with Special uses and meaning. These "metacharacters" are: the square bracket [...], the backslash \, the caret ^, the dollar sign $, the period or dot ., the vertical bar or pipe symbol |, the question mark ?, the asterisk or star *, the plus sign +, the round bracket (…) and the Curly Brace {…}.

Below table well explain us with the usability of each metacharacter.


Read the rest of this entry »