0

hi,

i want aregular expression which allows numbers and one period

eg 325.50, 25.20

and allow only two didgits after the period

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Rashakil Fol
0

i tried to create thr regular expression..

[1-9]+(\.[0-9][0-9])?

but this doesnt work ... actually i want this for validation purposes to check before saving to database thet price mathches the regular expression...

and one more thing whats the use of preceding @ symbol before wring a string in c#

eg; str = @"Select * from emp";

1

For starters, replace [1-9]+ with [1-9][0-9]*

When you use a preceding @ sign in C#, that means escape characters won't work. You can then write backslashes freely.

For example, @"C:\Documents and Settings\rashakil\My Documents\serkan love files" would be a valid string literal. If you want to write a double quote character in such a representation, I think (but you should double check that) you can write it by writing two double quote characters: @"blah "" hah" == "blah \" hah"

Votes + Comments
The subtility of your style is by moments unsurpassable LOL!
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.