How can I fix this regex expression?

前端 未结 3 1920
萌比男神i
萌比男神i 2021-01-28 19:12

Preface: This question is a derivative of this question.


Here is my code:

using System;
using System.Linq;
using System.Text.RegularExpressions;

c         


        
3条回答
  •  半阙折子戏
    2021-01-28 19:48

    Use negative lookbehind, positive lookbehind, character class with quanitifer, positive lookahead, and negative lookahead.

    Working Demo

    using System;
    using System.Linq;
    using System.Text.RegularExpressions;
    
    class MainClass {
      public static void Main (string[] args) {
            const string rawLine = "\"TeamName\",\"PlayerName\",\"Position\"  \"Chargers\",\"Philip Rivers\",\"QB\"  \"Colts\",\"Peyton Manning\",\"QB\"  \"Patriots\",\"Tom Brady\",\"QB\"";
                var parsedLines = Regex.Split(rawLine, "(?

提交回复
热议问题