jeudi 1 septembre 2016

c# String filtering and split with regex match

I'm trying to to filter strings with regex but i'm not that familiar with regex so i need a little help. Also i need to check if string contains specific regex part like example of input bellow:

Input (string):

"<value1;127.0.0.1:20000;value2;value3>Lorem ipsum dolor sit amet!"

If exist return these values:

string val1 = ????; //can't be null or empty, must be at least 3 chars/ints
string val2 = ????; //can be empty string
string val3 = ????; //can be empty string
string ipaddress = ????; // can't be empty
string text = ????; //can be empty string

Otherwise if not exist return only "lorem ipsum..." text:

string text = ????; //can be empty string

So first i need to check if that specific part exist in full string. String can be without that part.

Can please someone explain me how I can do that?

Aucun commentaire:

Enregistrer un commentaire