Golang regexp to match multiple patterns between keyword pairs
<p>I have a string which has two keywords: "CURRENT NAME(S)" and "NEW NAME(S)" and each of these keywords are followed by a bunch of words. I want to extract those set of words beyond each of these keywords. To elaborate with a code:</p>

<pre><code>    s := `"CURRENT NAME(S)
 Name1, Name2",,"NEW NAME(S)
NewName1,NewName2"`
    re := regexp.MustCompile(`"CURRENT NAME(S).*",,"NEW NAME(S).*"`)

    segs := re.FindAllString(s, -1)
    fmt.Println("segs:", segs)

    segs2 := re.FindAllStringSubmatch(s, -1)
    fmt.Println("segs2:", segs2)
</code></pre>

<p>As you can see, the string 's' has the input. "Name1,Name2" is the current names list and "NewName1, NewName2" is the new names list. I want to extract these two lists. The two lists are separated by a comma. Each of the keywords are beginning with a double quote and their reach ends, when their corresponding double quote ends.</p>

<p>What is the way to use regexp such that the program can print "<code>Name1, Name2</code>" and "<code>NewName1,NewName2</code>" ?</p>