current position:Home>How to extract the characters of a paragraph in Notepad?

How to extract the characters of a paragraph in Notepad?

2022-02-03 00:25:23 CSDN Q & A

For example, I want to extract “qaz”“qwe”“ert” These characters ? How to write a program

img




Refer to the answer 1:

Use regular expressions to extract , Examples are as follows :

static void Main(string[] args){    var textList = new[]    {        "V02-US-211206-YYX-9-16-qaz-EN-game",        "V03-US-211206-YYX-9-16--qwe-EN-game",        "V02-US-211206-YYX-9-16-ert-EN-game"    };    var pattern = @"YYX-9-16[-]+(.+)-EN";    foreach (var text in textList)    {        var matches = Regex.Matches(text, pattern);        foreach (Match match in matches)        {            Console.WriteLine($" Extracted results ==>>{match.Groups[1].Value}");        }    }    Console.ReadKey();}

Running results :

 Extracted results ==>>qaz Extracted results ==>>qwe Extracted results ==>>ert



Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030025205595.html

Random recommended