You need to know what 'valid' means. No numbers in string? Less than 50 characters? Must start with '{'? Must have an even number of double quote characters? No spaces between pairs of double quotes? Pairs of uppercase letters must be repeated? There
are many, many, many ways to be valid or invalid.
I want to confirm with you if you need a regular expression to match the following characters,and regard curly braces as special symbols to match.
{"AB_AB_Test":"TestValue",....}
Do you mean to match the content in curly braces, this content should meet the regular expression, can you
describe it in detail?
Best Regards,
YihuiSun
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
29 Posts
How to validate the given string in regular expression?
May 12, 2020 06:33 AM|kaarthikeyan|LINK
Team,
The below strings are examples, i need to validate by regular expression.
{"AB_AB_Test":"TestValue",....}
Please help on this.
Participant
1620 Points
927 Posts
Re: How to validate the given string in regular expression?
May 12, 2020 06:44 AM|PaulTheSmith|LINK
You need to know what 'valid' means. No numbers in string? Less than 50 characters? Must start with '{'? Must have an even number of double quote characters? No spaces between pairs of double quotes? Pairs of uppercase letters must be repeated? There are many, many, many ways to be valid or invalid.
What are your rules?
None
0 Points
29 Posts
Re: How to validate the given string in regular expression?
May 12, 2020 06:52 AM|kaarthikeyan|LINK
No spaces.. no repitation... only symbols allowed is _,"",{}
Participant
1620 Points
927 Posts
Re: How to validate the given string in regular expression?
May 13, 2020 01:33 AM|PaulTheSmith|LINK
So your examples were ones that failed?
Some valid examples
"{,
_
,
Some invalid examples
" { - not valid because it has a space
{{ - not valid because of repetition
a - not valid because not one of allowed symbols
Is this right? It seems very odd.
Contributor
2750 Points
781 Posts
Re: How to validate the given string in regular expression?
May 14, 2020 10:29 AM|YihuiSun|LINK
Hi, kaarthikeyan
{"AB_AB_Test":"TestValue",....}
Best Regards,
YihuiSun