Check empty and digit input with regex at same time in MVC












2















First I want to check that if input is null than show error and if input has digit value than also show an error.... So what's pattern for this? I hope that you understand my questions Thanks!



[RegularExpression(@"^[D]$", ErrorMessage = "Input Cannot be empty and must have Alphabets only")]

public string FirstName { get; set; }









share|improve this question




















  • 1





    What is environment you are working in? programming language, web framework?

    – Fabio
    Nov 19 '18 at 23:22






  • 1





    Regexps cannot detect null values. They only work with strings. You might have meant empty string.

    – Wiktor Stribiżew
    Nov 19 '18 at 23:25













  • @NRitH I already removed that tag

    – Nick
    Nov 20 '18 at 2:55











  • @WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

    – Asif Shakir
    Nov 20 '18 at 7:15











  • @Fabio please check i have edit the code for more clear understanding .

    – Asif Shakir
    Nov 20 '18 at 7:24
















2















First I want to check that if input is null than show error and if input has digit value than also show an error.... So what's pattern for this? I hope that you understand my questions Thanks!



[RegularExpression(@"^[D]$", ErrorMessage = "Input Cannot be empty and must have Alphabets only")]

public string FirstName { get; set; }









share|improve this question




















  • 1





    What is environment you are working in? programming language, web framework?

    – Fabio
    Nov 19 '18 at 23:22






  • 1





    Regexps cannot detect null values. They only work with strings. You might have meant empty string.

    – Wiktor Stribiżew
    Nov 19 '18 at 23:25













  • @NRitH I already removed that tag

    – Nick
    Nov 20 '18 at 2:55











  • @WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

    – Asif Shakir
    Nov 20 '18 at 7:15











  • @Fabio please check i have edit the code for more clear understanding .

    – Asif Shakir
    Nov 20 '18 at 7:24














2












2








2








First I want to check that if input is null than show error and if input has digit value than also show an error.... So what's pattern for this? I hope that you understand my questions Thanks!



[RegularExpression(@"^[D]$", ErrorMessage = "Input Cannot be empty and must have Alphabets only")]

public string FirstName { get; set; }









share|improve this question
















First I want to check that if input is null than show error and if input has digit value than also show an error.... So what's pattern for this? I hope that you understand my questions Thanks!



[RegularExpression(@"^[D]$", ErrorMessage = "Input Cannot be empty and must have Alphabets only")]

public string FirstName { get; set; }






asp.net regex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 7:54









Foo

1




1










asked Nov 19 '18 at 23:20









Asif ShakirAsif Shakir

239




239








  • 1





    What is environment you are working in? programming language, web framework?

    – Fabio
    Nov 19 '18 at 23:22






  • 1





    Regexps cannot detect null values. They only work with strings. You might have meant empty string.

    – Wiktor Stribiżew
    Nov 19 '18 at 23:25













  • @NRitH I already removed that tag

    – Nick
    Nov 20 '18 at 2:55











  • @WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

    – Asif Shakir
    Nov 20 '18 at 7:15











  • @Fabio please check i have edit the code for more clear understanding .

    – Asif Shakir
    Nov 20 '18 at 7:24














  • 1





    What is environment you are working in? programming language, web framework?

    – Fabio
    Nov 19 '18 at 23:22






  • 1





    Regexps cannot detect null values. They only work with strings. You might have meant empty string.

    – Wiktor Stribiżew
    Nov 19 '18 at 23:25













  • @NRitH I already removed that tag

    – Nick
    Nov 20 '18 at 2:55











  • @WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

    – Asif Shakir
    Nov 20 '18 at 7:15











  • @Fabio please check i have edit the code for more clear understanding .

    – Asif Shakir
    Nov 20 '18 at 7:24








1




1





What is environment you are working in? programming language, web framework?

– Fabio
Nov 19 '18 at 23:22





What is environment you are working in? programming language, web framework?

– Fabio
Nov 19 '18 at 23:22




1




1





Regexps cannot detect null values. They only work with strings. You might have meant empty string.

– Wiktor Stribiżew
Nov 19 '18 at 23:25







Regexps cannot detect null values. They only work with strings. You might have meant empty string.

– Wiktor Stribiżew
Nov 19 '18 at 23:25















@NRitH I already removed that tag

– Nick
Nov 20 '18 at 2:55





@NRitH I already removed that tag

– Nick
Nov 20 '18 at 2:55













@WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

– Asif Shakir
Nov 20 '18 at 7:15





@WiktorStribiżew yeah i means that first check input is empty and second check the input has number?

– Asif Shakir
Nov 20 '18 at 7:15













@Fabio please check i have edit the code for more clear understanding .

– Asif Shakir
Nov 20 '18 at 7:24





@Fabio please check i have edit the code for more clear understanding .

– Asif Shakir
Nov 20 '18 at 7:24












3 Answers
3






active

oldest

votes


















1














^d*$ will match any input value that is either empty or composed solely of digits. Alternatively D will match any input value that has at least one character that is not a digit. For example, in Javascript:






console.log(/^d*$/.test(''));
console.log(/^d*$/.test('123'));
console.log(/^d*$/.test('x1'));
console.log(/D/.test(''));
console.log(/D/.test('123'));
console.log(/D/.test('x1'));








share|improve this answer































    1














    Your solution does not work for you because the ^[D]$ pattern matches a string that only contains a single char other than a digit. Note that [ and ] can be safely removed as character classes only make sense when they have multiple chars/char ranges in them.



    I suggest



    [RegularExpression(@"^D+$", ErrorMessage = "Input can have no digits.")]
    public string FirstName { get; set; }


    The @"^D+$" pattern only matches a string that has no digits in it. Note that RegularExpressionAttribute patterns should always match the whole input, so ^ and $ anchors are good to use here.






    share|improve this answer


























    • Your pattern does not work - I think it works but in another way: Match with this pattern

      – Foo
      Nov 20 '18 at 7:52











    • @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

      – Wiktor Stribiżew
      Nov 20 '18 at 7:52













    • @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

      – Asif Shakir
      Nov 20 '18 at 7:57











    • @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

      – Wiktor Stribiżew
      Nov 20 '18 at 7:58













    • @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

      – Asif Shakir
      Nov 20 '18 at 8:00



















    1














    [Required(ErrorMessage = "{0} cannot be empty")]
    [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} must have Alphabets only")]
    [Display(Name = "First name")]
    public string FirstName { get; set; }


    Error message if the input is empty:




    First name cannot be empty




    and if the input value contains non alphabet character(s):




    First name must have Alphabets only






    If you want to allow empty value, you could try:



    [RegularExpression(@"(^$)|(^[a-zA-Z]+$)", ErrorMessage = "{0} must have Alphabets only")]


    (^$) allow an empty string. Then, if it's NOT empty, continue to check with the pattern (^[a-zA-Z]+$) (alphabet characters only).






    share|improve this answer
























    • Without using [Required] how i dont Allow empty string with Regex pattern.

      – Asif Shakir
      Nov 20 '18 at 8:44











    • @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

      – Foo
      Nov 20 '18 at 8:47











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384047%2fcheck-empty-and-digit-input-with-regex-at-same-time-in-mvc%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    ^d*$ will match any input value that is either empty or composed solely of digits. Alternatively D will match any input value that has at least one character that is not a digit. For example, in Javascript:






    console.log(/^d*$/.test(''));
    console.log(/^d*$/.test('123'));
    console.log(/^d*$/.test('x1'));
    console.log(/D/.test(''));
    console.log(/D/.test('123'));
    console.log(/D/.test('x1'));








    share|improve this answer




























      1














      ^d*$ will match any input value that is either empty or composed solely of digits. Alternatively D will match any input value that has at least one character that is not a digit. For example, in Javascript:






      console.log(/^d*$/.test(''));
      console.log(/^d*$/.test('123'));
      console.log(/^d*$/.test('x1'));
      console.log(/D/.test(''));
      console.log(/D/.test('123'));
      console.log(/D/.test('x1'));








      share|improve this answer


























        1












        1








        1







        ^d*$ will match any input value that is either empty or composed solely of digits. Alternatively D will match any input value that has at least one character that is not a digit. For example, in Javascript:






        console.log(/^d*$/.test(''));
        console.log(/^d*$/.test('123'));
        console.log(/^d*$/.test('x1'));
        console.log(/D/.test(''));
        console.log(/D/.test('123'));
        console.log(/D/.test('x1'));








        share|improve this answer













        ^d*$ will match any input value that is either empty or composed solely of digits. Alternatively D will match any input value that has at least one character that is not a digit. For example, in Javascript:






        console.log(/^d*$/.test(''));
        console.log(/^d*$/.test('123'));
        console.log(/^d*$/.test('x1'));
        console.log(/D/.test(''));
        console.log(/D/.test('123'));
        console.log(/D/.test('x1'));








        console.log(/^d*$/.test(''));
        console.log(/^d*$/.test('123'));
        console.log(/^d*$/.test('x1'));
        console.log(/D/.test(''));
        console.log(/D/.test('123'));
        console.log(/D/.test('x1'));





        console.log(/^d*$/.test(''));
        console.log(/^d*$/.test('123'));
        console.log(/^d*$/.test('x1'));
        console.log(/D/.test(''));
        console.log(/D/.test('123'));
        console.log(/D/.test('x1'));






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 2:54









        NickNick

        27.9k121941




        27.9k121941

























            1














            Your solution does not work for you because the ^[D]$ pattern matches a string that only contains a single char other than a digit. Note that [ and ] can be safely removed as character classes only make sense when they have multiple chars/char ranges in them.



            I suggest



            [RegularExpression(@"^D+$", ErrorMessage = "Input can have no digits.")]
            public string FirstName { get; set; }


            The @"^D+$" pattern only matches a string that has no digits in it. Note that RegularExpressionAttribute patterns should always match the whole input, so ^ and $ anchors are good to use here.






            share|improve this answer


























            • Your pattern does not work - I think it works but in another way: Match with this pattern

              – Foo
              Nov 20 '18 at 7:52











            • @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:52













            • @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

              – Asif Shakir
              Nov 20 '18 at 7:57











            • @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:58













            • @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

              – Asif Shakir
              Nov 20 '18 at 8:00
















            1














            Your solution does not work for you because the ^[D]$ pattern matches a string that only contains a single char other than a digit. Note that [ and ] can be safely removed as character classes only make sense when they have multiple chars/char ranges in them.



            I suggest



            [RegularExpression(@"^D+$", ErrorMessage = "Input can have no digits.")]
            public string FirstName { get; set; }


            The @"^D+$" pattern only matches a string that has no digits in it. Note that RegularExpressionAttribute patterns should always match the whole input, so ^ and $ anchors are good to use here.






            share|improve this answer


























            • Your pattern does not work - I think it works but in another way: Match with this pattern

              – Foo
              Nov 20 '18 at 7:52











            • @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:52













            • @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

              – Asif Shakir
              Nov 20 '18 at 7:57











            • @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:58













            • @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

              – Asif Shakir
              Nov 20 '18 at 8:00














            1












            1








            1







            Your solution does not work for you because the ^[D]$ pattern matches a string that only contains a single char other than a digit. Note that [ and ] can be safely removed as character classes only make sense when they have multiple chars/char ranges in them.



            I suggest



            [RegularExpression(@"^D+$", ErrorMessage = "Input can have no digits.")]
            public string FirstName { get; set; }


            The @"^D+$" pattern only matches a string that has no digits in it. Note that RegularExpressionAttribute patterns should always match the whole input, so ^ and $ anchors are good to use here.






            share|improve this answer















            Your solution does not work for you because the ^[D]$ pattern matches a string that only contains a single char other than a digit. Note that [ and ] can be safely removed as character classes only make sense when they have multiple chars/char ranges in them.



            I suggest



            [RegularExpression(@"^D+$", ErrorMessage = "Input can have no digits.")]
            public string FirstName { get; set; }


            The @"^D+$" pattern only matches a string that has no digits in it. Note that RegularExpressionAttribute patterns should always match the whole input, so ^ and $ anchors are good to use here.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 20 '18 at 7:52

























            answered Nov 20 '18 at 7:47









            Wiktor StribiżewWiktor Stribiżew

            313k16133210




            313k16133210













            • Your pattern does not work - I think it works but in another way: Match with this pattern

              – Foo
              Nov 20 '18 at 7:52











            • @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:52













            • @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

              – Asif Shakir
              Nov 20 '18 at 7:57











            • @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:58













            • @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

              – Asif Shakir
              Nov 20 '18 at 8:00



















            • Your pattern does not work - I think it works but in another way: Match with this pattern

              – Foo
              Nov 20 '18 at 7:52











            • @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:52













            • @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

              – Asif Shakir
              Nov 20 '18 at 7:57











            • @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

              – Wiktor Stribiżew
              Nov 20 '18 at 7:58













            • @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

              – Asif Shakir
              Nov 20 '18 at 8:00

















            Your pattern does not work - I think it works but in another way: Match with this pattern

            – Foo
            Nov 20 '18 at 7:52





            Your pattern does not work - I think it works but in another way: Match with this pattern

            – Foo
            Nov 20 '18 at 7:52













            @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

            – Wiktor Stribiżew
            Nov 20 '18 at 7:52







            @TânNguyễn In answers, "does not work" means "does not work for OP". Edited the wording in answer.

            – Wiktor Stribiżew
            Nov 20 '18 at 7:52















            @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

            – Asif Shakir
            Nov 20 '18 at 7:57





            @WiktorStribiżew i understand it and used this pattern that's only wotk for digit checking but not working for empty input. how to check empty string with changing in this pattern?

            – Asif Shakir
            Nov 20 '18 at 7:57













            @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

            – Wiktor Stribiżew
            Nov 20 '18 at 7:58







            @AsifShakir If you need to show error if the input is empty, use [Required]. There is no reason for you to want to avoid it.

            – Wiktor Stribiżew
            Nov 20 '18 at 7:58















            @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

            – Asif Shakir
            Nov 20 '18 at 8:00





            @WiktorStribiżew yeah you are right . But any possible way to check empty string with this pattern ?

            – Asif Shakir
            Nov 20 '18 at 8:00











            1














            [Required(ErrorMessage = "{0} cannot be empty")]
            [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} must have Alphabets only")]
            [Display(Name = "First name")]
            public string FirstName { get; set; }


            Error message if the input is empty:




            First name cannot be empty




            and if the input value contains non alphabet character(s):




            First name must have Alphabets only






            If you want to allow empty value, you could try:



            [RegularExpression(@"(^$)|(^[a-zA-Z]+$)", ErrorMessage = "{0} must have Alphabets only")]


            (^$) allow an empty string. Then, if it's NOT empty, continue to check with the pattern (^[a-zA-Z]+$) (alphabet characters only).






            share|improve this answer
























            • Without using [Required] how i dont Allow empty string with Regex pattern.

              – Asif Shakir
              Nov 20 '18 at 8:44











            • @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

              – Foo
              Nov 20 '18 at 8:47
















            1














            [Required(ErrorMessage = "{0} cannot be empty")]
            [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} must have Alphabets only")]
            [Display(Name = "First name")]
            public string FirstName { get; set; }


            Error message if the input is empty:




            First name cannot be empty




            and if the input value contains non alphabet character(s):




            First name must have Alphabets only






            If you want to allow empty value, you could try:



            [RegularExpression(@"(^$)|(^[a-zA-Z]+$)", ErrorMessage = "{0} must have Alphabets only")]


            (^$) allow an empty string. Then, if it's NOT empty, continue to check with the pattern (^[a-zA-Z]+$) (alphabet characters only).






            share|improve this answer
























            • Without using [Required] how i dont Allow empty string with Regex pattern.

              – Asif Shakir
              Nov 20 '18 at 8:44











            • @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

              – Foo
              Nov 20 '18 at 8:47














            1












            1








            1







            [Required(ErrorMessage = "{0} cannot be empty")]
            [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} must have Alphabets only")]
            [Display(Name = "First name")]
            public string FirstName { get; set; }


            Error message if the input is empty:




            First name cannot be empty




            and if the input value contains non alphabet character(s):




            First name must have Alphabets only






            If you want to allow empty value, you could try:



            [RegularExpression(@"(^$)|(^[a-zA-Z]+$)", ErrorMessage = "{0} must have Alphabets only")]


            (^$) allow an empty string. Then, if it's NOT empty, continue to check with the pattern (^[a-zA-Z]+$) (alphabet characters only).






            share|improve this answer













            [Required(ErrorMessage = "{0} cannot be empty")]
            [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} must have Alphabets only")]
            [Display(Name = "First name")]
            public string FirstName { get; set; }


            Error message if the input is empty:




            First name cannot be empty




            and if the input value contains non alphabet character(s):




            First name must have Alphabets only






            If you want to allow empty value, you could try:



            [RegularExpression(@"(^$)|(^[a-zA-Z]+$)", ErrorMessage = "{0} must have Alphabets only")]


            (^$) allow an empty string. Then, if it's NOT empty, continue to check with the pattern (^[a-zA-Z]+$) (alphabet characters only).







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 20 '18 at 8:00









            FooFoo

            1




            1













            • Without using [Required] how i dont Allow empty string with Regex pattern.

              – Asif Shakir
              Nov 20 '18 at 8:44











            • @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

              – Foo
              Nov 20 '18 at 8:47



















            • Without using [Required] how i dont Allow empty string with Regex pattern.

              – Asif Shakir
              Nov 20 '18 at 8:44











            • @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

              – Foo
              Nov 20 '18 at 8:47

















            Without using [Required] how i dont Allow empty string with Regex pattern.

            – Asif Shakir
            Nov 20 '18 at 8:44





            Without using [Required] how i dont Allow empty string with Regex pattern.

            – Asif Shakir
            Nov 20 '18 at 8:44













            @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

            – Foo
            Nov 20 '18 at 8:47





            @AsifShakir In that case, you just need [RegularExpression(@"^[a-zA-Z]+$", ErrorMessage = "{0} is not valid.")]. This is not allowed an empty string and non alphabet characters with the error message: First name is not valid.

            – Foo
            Nov 20 '18 at 8:47


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384047%2fcheck-empty-and-digit-input-with-regex-at-same-time-in-mvc%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?