Blog

Regular Expressions in .NET

By Samir Bhogayta Blogs | .NET 4.5 Oct 29, 2013
This blog defines regular expressions in .net.

Positive decimal value regular expression with max 3 decimal places:

Regular Expressions, .NET, C# Programming Language

  • Accepts all positive decimal values (currently only accepts values greater and equal to one (1))
  • i.e accepts ---> 0.0001
  • Can have maximum 3 decimal places.
  • Decimal places are optional.

This regular expression will be used to validate currency input.

1:ValidationExpression="^\d*[1-9]\d*(\.\d+)?$"

Validate Indian Vehicle Number:

@"^[a-zA-Z]{2}[a-zA-Z0-9]{0,6}[0-9]{3}$"

COMMENT USING