I am trying to work on a regex that will take a string and divide it into different groups so that way I may call upon the groups as needed for my code. Below is the string I am attempting to make a pattern out of. This string comes from a database in SQL, however I am not sure if the following string is a JSON or not:
{"data":"","displayException":"Unable to authenticate user. Please make sure you have an
existing account. If you do not, select Register to create an account. Please contact
1-234-567-8910 M-F 9a-5pm CT for further assistance.","exception":"UNABLE TO LOGIN",
"success":false}
Below is the pattern I am working on:
@"("(.*)"\:\"\"\,)(\"(.*)\"\:)(\"(.*)\")"
The problem I am having is that when it matches, I am getting multiple lines of the same thing. Below is a split list of how this is matching:
0. {
1. "data":"",
2. data
3. "displayException":"Unable to authenticate user. Please make sure you have an existing account. If you do not, select Register to create an account. Please contact 1-234-567-8910 M-F 9a-5pm CT for further assistance.","exception":
4. displayException":"Unable to authenticate user. Please make sure you have an existing account. If you do not, select Register to create an account. Please contact 1-234-567-8910 M-F 9a-5pm CT for further assistance.","exception
5. "UNABLE TO LOGIN","success"
6. UNABLE TO LOGIN","success
7. :false}
What I want is essentially is one line similar to 4 but without the quotes in the middle, and one like like 6 but with "exception" in front not on the end of 4 and line 7 combined with 6 (if you want to add it great if not I can do that)
So my question is, in regex is their a way that I can delete those unnecessary lines, or is my regex just false and theirs a better one, or am I just have to force to call out those even numbers? Any help is appreciated!