There is a text file in which the text of this type: X56373Y57483W46373H4747A0 .
Is it possible in C # to pull the values in turn from the proposed line, for example X56373 , then separately Y57483 and W46373 ? If so, how?
There is a text file in which the text of this type: X56373Y57483W46373H4747A0 .
Is it possible in C # to pull the values in turn from the proposed line, for example X56373 , then separately Y57483 and W46373 ? If so, how?
Here is one of the options:
string input = "X56373Y57483W46373H4747A0"; string pattern = @"(X\d+)|(Y\d+)|(W\d+)"; Regex regex = new Regex(pattern); MatchCollection matches = regex.Matches(input); foreach (Match match in matches) { Console.WriteLine(match.Value); } You can try this:
string text = @"X56373Y57483W46373H4747A0"; Regex regex = new Regex(@"[AZ]\d+"); var matches = regex.Matches(text); \D - GrundySource: https://ru.stackoverflow.com/questions/602466/
All Articles
Regex.Matches(s, @"\w\d+")- Grundy