locked
what is the regular expression for the double value? RRS feed

Answers

  • May be you can try using this for validating double value.

    \d{0,10}\.\d{1,10}

    Here the digits 0,10 before the decimal point

    1,10 after the decimal point.

    However you can change the decimal digits accordingly.

    Hope it helps you.


    Thomas [Kotagiri]

    Thursday, October 17, 2013 12:47 PM

All replies

  • Hi, 

    try to convert your double value to string.


    Nimzozo, from France.

    Thursday, October 17, 2013 11:37 AM
  • Thanks dear,,its is not possible to directly match the double number into regex???  
    Thursday, October 17, 2013 11:42 AM
  • I don't think, all Regex methods only accept string parameter.

    http://msdn.microsoft.com/en-us/library/vstudio/system.text.regularexpressions.regex.aspx


    Nimzozo, from France.

    Thursday, October 17, 2013 11:59 AM
  • Thursday, October 17, 2013 12:03 PM
  • May be you can try using this for validating double value.

    \d{0,10}\.\d{1,10}

    Here the digits 0,10 before the decimal point

    1,10 after the decimal point.

    However you can change the decimal digits accordingly.

    Hope it helps you.


    Thomas [Kotagiri]

    Thursday, October 17, 2013 12:47 PM
  •         

    dear i have tried your expression in given code but it also allow to take and other text

    private void txtInputvalue_PreviewTextInput(object sender, TextCompositionEventArgs e)
            {
                Regex _regex = new Regex(@"\d{0,10}\.\d{1,10}");
                e.Handled = _regex.IsMatch(e.Text);
            }

    Thursday, October 17, 2013 1:19 PM