@mohininemade301094 - you should use Regex.Split for this instead of the normal string.split. This will allow you to isolate the commas to be only those outside of quotation marks. This regex code should grab all commas outside of the quotes (?!\B"[^"]*),(?![^"]*"\B)
I tested this out using your original string: FirstName,LastName,Mr,T,"Note: , First Line,this is contact detail of T"
I used Regex.Split(YourString,RegexPattern) and got an array of 5 strings as follows:
- FirstName
- LastName
- Mr
- T
- “Note: , First Line,this is contact detail of T”
EDIT: the string you have written in the first post won’t work with my regex pattern because it is using weird double quotes. If it does indeed use those weird double quotes, you should use this regex pattern instead: (?!\B("|“|”)[^("|“|”)]*),(?![^("|“|”)]*("|“|”)\B)
Also, the pattern will struggle if there are multiple double quotes it is searching through. If you have the possibility that it will contain multiple double quotes in your input string (e.g. Mr,T,“Test,1”,Address,“Details,here”) then you should first split by finding every second double quote, then run the regex split mentioned in my comment here