now given an original string, example: abcdefgh, a template rule, example: ab {{}} de {{}} h
where {{}} represents any match, and there may be 0 or more {{}} in a template. It is required to write a function to match the template first. If the original string conforms to the template rules, the variable is extracted. The result of the example is the array
of ["c", fg "].function (str string, temp string) (bool, []string) {
// strtempfalse
// abcdefgh ab{{}}de{{}}h abcdefghi ab{{}}de{{}}hi
//
}
I"ve thought about it. Either regular or character split, is easy to solve for a variable symbol, but for multiple variable symbols, full-text matching will fail. I"d like to consult
.