Liste des Groupes | Revenir à cl awk |
On 10.04.2025 09:06, Janis Papanagnou wrote:Correct, you can't do what you want using just `match()`, it's simply matching a regexp with capture groups against a string, just like sed does.I'm looking for subexpressions of regexp-matches using GNU Awk'sTo clarify; what I wanted is access of the values "r1", "r2", "r3",
third parameter of match(). For example
>
data = "R=r1,R=r2,R=r3,E=e"
match (data, /^(R=([^,]+),){2,5}E=(.+)$/, arr)
>
The result stored in 'arr' seems to be determined by the static
parenthesis structure, so with the pattern repetition {2,5} only
the last matched data in the subexpression (r3) seems to persist
in arr. - I suppose there's no cute way to achieve what I wanted?
and "e" through 'arr'.
Les messages affichés proviennent d'usenet.