I have a CSV string that I want to split on commas, but only if the comma isn't preceded by a specific word somewhere else before it in the string.
Below is an example of the input.
1,2,3,Test Message,JSON={ "book": { "title": "Hello, there, world" } }
In the above case, any commas after the word 'JSON=' should not cause the string to split, so I would be hoping for the following split.
1
2
3
Test Message
JSON={ "book": { "title": "Hello, there, world" } }
Ideally, I'd like to use Regex.Split
to split the string and I think I need to use a negative look behind, but I'm not sure of the syntax required to achieve this.
Any help would be greatly appreciated.