The string has the characters ^^ and ^ , and between them is the value. Can you please tell me how to get it? The string can be of any length, and have any content. ^ Characters can be repeated.
- Complete the question, otherwise the clarifying questions already in the answers went instead of the answers themselves. - Visman
|
1 answer
Something like this:
class Program { static void Main(string[] args) { var rx = new Regex(@"\^{2}([^\^]+)\^"); //один из вариантов var text = "sdafasdf^^value1^adgdafg^^value2^sdfdf"; var matches = rx.Matches(text); foreach (Match match in matches) { var m = match.Groups[1].Value; //Берем содержимое скобок (1-ой группы) Console.WriteLine(m); //Output: //value1 //value2 } Console.ReadKey(); } } - There's always this type: text ^^ value ^ text. That is, the line can not be the second time ^^. - dexploizer
- And then easy. I'll change the answer now. - Sergey
- Is done. Try it. - Sergey
- Where can you put a plus sign ?) - dexploizer
- Yes, the answer is straight plus) - Sergey
|