I have string with product information and I would like to parse that string and read the product information.
My string look like this:
ID: 1
NAME: Product name
INFORMATION: Here goes the information about a product
STATUS: Available
I would like to parse this text in this way:
string id = product id;
string name = product name;
string info = product information;
string available = product availability;
How can I accomplish that. I know it’s possible with groups but I’m stuck and don’t how do that.
Thanks in advance.
You can parse the data quite easily, for example, to a dictionary.
Note that you don’t really need a regex here, this is even nicer without one:
A regex option, with some space trimming: