diff --git a/client/parse.go b/client/parse.go index 382b7345..60c6fcdf 100644 --- a/client/parse.go +++ b/client/parse.go @@ -19,23 +19,29 @@ import ( ) func findSample(body []byte) (input [][]byte, output [][]byte, err error) { - irg := regexp.MustCompile(`class="input"[\s\S]*?
([\s\S]*?)`) - org := regexp.MustCompile(`class="output"[\s\S]*?
([\s\S]*?)`) + irg := regexp.MustCompile(`
]*>([\s\S]*?)`) + org := regexp.MustCompile(`
]*>([\s\S]*?)`) + a := irg.FindAllSubmatch(body, -1) b := org.FindAllSubmatch(body, -1) + if a == nil || b == nil || len(a) != len(b) { return nil, nil, fmt.Errorf("Cannot parse sample with input %v and output %v", len(a), len(b)) } - newline := regexp.MustCompile(`<[\s/br]+?>`) + + tagRegex := regexp.MustCompile(`