what does
numericregex = @"^[0-9]{5}
means?
because i want to set minimum 4 maximum 18
what does
numericregex = @"^[0-9]{5}
means?
because i want to set minimum 4 maximum 18
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Muhammad Imran AnsariPosted May 25, 2023, 7:08 PM
In C#, you can use the following regular expression (regex) pattern to enforce a minimum length of 4 and a maximum length of 18:
Anandu G NathPosted Dec 27, 2023, 3:46 AM
@Basit Nisar
You can use the below code
Subarta RayPosted Dec 26, 2023, 12:59 PM
The provided regular expression
^[0-9]{5}is designed to match a string that:^asserts the start of the string.[0-9]matches any digit from 0 to 9.{5}specifies that there should be exactly five digits.So,
^[0-9]{5}matches a string that starts with exactly five digits.If you want to modify this regex to set a minimum of 4 and a maximum of 18 digits, you can use the following pattern:
string numericRegex = @"^[0-9]{4,18}";
Mohit KalaPosted May 26, 2023, 5:54 AM
string regexPattern= @"^\d{4,18}$";
it will allow min 4 digit and max 18 digits
Jignesh KumarPosted May 26, 2023, 4:39 AM
Hi Nasir,
Please check below one,
Janarthanan SPosted May 25, 2023, 2:26 PM
To modify the regular expression to match a minimum of 4 and a maximum of 18 digits, you can update it as follows:
numericregex = @"^[0-9]{4,18}"The modification involves using a quantifier
{4,18}after the character class[0-9]. This quantifier specifies that the preceding character class (digit) should occur at least 4 times and at most 18 times.Amit MohantyPosted May 25, 2023, 2:05 PM
The expression
@"^[0-9]{5}"is a regular expression pattern that matches a string consisting of exactly five numeric digits (0-9) at the beginning of the string. To enforce the minimum number of 4 and maximum number of 18 in C#, you can utilize the following pattern: