Check empty and digit input with regex at same time in MVC
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
|
show 5 more comments
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
1
What is environment you are working in? programming language, web framework?
– Fabio
Nov 19 '18 at 23:22
1
Regexps cannot detectnull
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
|
show 5 more comments
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
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
asp.net regex
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 detectnull
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
|
show 5 more comments
1
What is environment you are working in? programming language, web framework?
– Fabio
Nov 19 '18 at 23:22
1
Regexps cannot detectnull
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
|
show 5 more comments
3 Answers
3
active
oldest
votes
^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'));
add a comment |
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.
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
|
show 1 more comment
[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).
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
^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'));
add a comment |
^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'));
add a comment |
^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'));
^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'));
answered Nov 20 '18 at 2:54
NickNick
27.9k121941
27.9k121941
add a comment |
add a comment |
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.
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
|
show 1 more comment
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.
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
|
show 1 more comment
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.
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.
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
|
show 1 more comment
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
|
show 1 more comment
[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).
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
add a comment |
[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).
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
add a comment |
[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).
[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).
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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