regular expression [modified]
-
following is the regular expression which i a using for the whole numbers and fractionl numbers(1 , 2 , 9999 , 3.9 , .8 , .09) [0-9]*.[0-9]* when i tested for the 1s it did not occur any error Please help
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Thursday, December 27, 2007 11:55:07 PM
-
following is the regular expression which i a using for the whole numbers and fractionl numbers(1 , 2 , 9999 , 3.9 , .8 , .09) [0-9]*.[0-9]* when i tested for the 1s it did not occur any error Please help
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Thursday, December 27, 2007 11:55:07 PM
-
ThanQ. I wanted that textbox can accept both whole numbers as well as te fractional numbers The expression , which u provided , excepts only fractional values
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
ThanQ. I wanted that textbox can accept both whole numbers as well as te fractional numbers The expression , which u provided , excepts only fractional values
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
here is ur solution, "^[1-9]+[0-9]*(\.{1}[0-9]+)?"
Hello Forum Always be in touch to help about the topic ASP.NET
-
ThanQ. I wanted that textbox can accept both whole numbers as well as te fractional numbers The expression , which u provided , excepts only fractional values
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Sonia Gupta wrote:
I wanted that textbox can accept both whole numbers as well as te fractional numbers
\b[\d]+$|\A([\d]+[\.]{1}[\d]+$|[\.]{1}[\d]+$)
This accepts the following patterns 17.12 .12 0.25 etc..
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
here is ur solution, "^[1-9]+[0-9]*(\.{1}[0-9]+)?"
Hello Forum Always be in touch to help about the topic ASP.NET
sulabh2020 wrote:
^[1-9]+[0-9]*(\.{1}[0-9]+)?
This is incorrect for the expected problem. This will fail to match
0.25 , 25.2255255555555555s
. If any text characters appeared in between the number, this expression will match the number part. If won't fail when character appears in between.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Sonia Gupta wrote:
I wanted that textbox can accept both whole numbers as well as te fractional numbers
\b[\d]+$|\A([\d]+[\.]{1}[\d]+$|[\.]{1}[\d]+$)
This accepts the following patterns 17.12 .12 0.25 etc..
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
Navaneeth , i want the basic book for regular expressions.Can u please refer me any one , a very basic especially for regular expressions.U know the expression u gave, i am not being able to understand it. If u can make me understand this term . ThanQ
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
Navaneeth , i want the basic book for regular expressions.Can u please refer me any one , a very basic especially for regular expressions.U know the expression u gave, i am not being able to understand it. If u can make me understand this term . ThanQ
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Sonia Gupta wrote:
Navaneeth , i want the basic book for regular expressions.Can u please refer me any one
I don't know any good books for regular expression. You can try RegExBuddy. It's good program which helps to write regular expressions.
Sonia Gupta wrote:
If u can make me understand this term .
I will try. Following is the explanation for above regular expression. I will split the above expression into small expressions, that is easy to understand.
\b[\d]+$
: This matches any digit in between 0-9 unlimited times. So matches all 12 , 1234 , 12345 etc. This won't match 125s or s584. So real number part is done. Now we need expression for fractional numbers. Bear it in mind, fractional numbers could be written in two ways, 12.32 and .32. Below is the expression which matches fractional numbers.\A([\d]+[\.]{1}[\d]+$|[\.]{1}[\d]+$)
: This contains two nested expressions for two types of fractional numbers. First one is([\d]+[\.]{1}[\d]+$
: which matches 0.25 , 12.25 etc. This fails to match .25 , 0..25.[\.]{1}[\d]+$)
this is the second nested expression which matches any number starts with.
symbol (.123,.87). These two expressions are combined using or(|
) operator. SO if first one fails, regex engine will look for a match with second one. In the same way these two expressions are combined with the first expression using another or operator. So regex engine will look for a real number without any decimal points first. If that one fails, it will enter into the second expression. Second expression is nested, so it will look for match with the first regex, and when it fails it will move to second. If all these fails, entire expression will be failed.\A
Asserts position at the beginning$
Asserts position at the end Hope it helpsAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Sonia Gupta wrote:
Navaneeth , i want the basic book for regular expressions.Can u please refer me any one
I don't know any good books for regular expression. You can try RegExBuddy. It's good program which helps to write regular expressions.
Sonia Gupta wrote:
If u can make me understand this term .
I will try. Following is the explanation for above regular expression. I will split the above expression into small expressions, that is easy to understand.
\b[\d]+$
: This matches any digit in between 0-9 unlimited times. So matches all 12 , 1234 , 12345 etc. This won't match 125s or s584. So real number part is done. Now we need expression for fractional numbers. Bear it in mind, fractional numbers could be written in two ways, 12.32 and .32. Below is the expression which matches fractional numbers.\A([\d]+[\.]{1}[\d]+$|[\.]{1}[\d]+$)
: This contains two nested expressions for two types of fractional numbers. First one is([\d]+[\.]{1}[\d]+$
: which matches 0.25 , 12.25 etc. This fails to match .25 , 0..25.[\.]{1}[\d]+$)
this is the second nested expression which matches any number starts with.
symbol (.123,.87). These two expressions are combined using or(|
) operator. SO if first one fails, regex engine will look for a match with second one. In the same way these two expressions are combined with the first expression using another or operator. So regex engine will look for a real number without any decimal points first. If that one fails, it will enter into the second expression. Second expression is nested, so it will look for match with the first regex, and when it fails it will move to second. If all these fails, entire expression will be failed.\A
Asserts position at the beginning$
Asserts position at the end Hope it helpsAll C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
instead of \b[\d]+$ can i write [0-9]* if yes what's the meaning of \b and \d
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
instead of \b[\d]+$ can i write [0-9]* if yes what's the meaning of \b and \d
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
Sonia Gupta wrote:
instead of \b[\d]+$ can i write [0-9]*
No instead of
[\d]+
you can write[0-9]*
.\b
is asserting position at the word boundaries.\d
matches any number from 0-9.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions