Search This Blog

Wednesday, 8 June 2016

Useful Regular Expression in C#.

Useful Regular Expression in C#.

White space is not allowed
(\S)+

Alphabets and Space
[a-zA-Z ]+$

Alphabets
^[A-z]+$

Numbers
^[0-9]+$

Alphanumeric
^[a-zA-Z0-9]*$

Email
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?

Mobile no.
^([7-9]{1})([0-9]{9})$

Date Format ( mm/dd/yyyy | mm-dd-yyyy | mm.dd.yyyy )

/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\\d\\d+$/

Website URL
^http(s)?://([\\w-]+.)+[\\w-]+(/[\\w- ./?%&=])?$

Credit Card Numbers
Visa
^4[0-9]{12}(?:[0-9]{3})?$ 

MasterCard
^5[1-5][0-9]{14}$ 

American Express
^3[47][0-9]{13}$ 

Decimal number
((\\d+)((\\.\\d{1,2})?))$  

IFSC CODE
^[^\s]{4}\d{7}$

PAN CARD
^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$

3 comments:

  1. Thanks for sharing the tutorial useful information.
    Dot Net Training in Chennai

    ReplyDelete
  2. This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Dot Net Training in Chennai. or learn thru ASP.NET Online Training . Nowadays Dot Net has tons of job opportunities on various vertical industry.

    ReplyDelete
  3. This blog gives very important info about .Net Thanks for sharing
    .Net Online Training Hyderabad

    ReplyDelete

Angular 6 tutorial for beginners

Angular 6 tutorial for beginners