Final goal. Say I need to transform
Input = """"
Curve.My_Curve_1,Points=[(1,10),(2,11),(3,12)]
Curve.My_Curve_2,Points=[(5,8),(6,13),(7,15)]
Curve.My_Curve_3,Points=[(11,8),(12,13),(13,15)]
"""
to
Output = """
Curve My_Curve_1 x_values=[1,2,3] y_values=[10,11,12]
Curve My_Curve_2 x_values=[5,7,7] y_values=[8,13,15]
Curve My_Curve_3 x_values=[11,12,13] y_values=[8,13,15]
"""
Say we can use special characters ≪ ≫
to represent a newline separated list and ⪻ ⪼
a comma separated list. I’d like to write something like
@extract Input "≪Curve.$curve_name,Points=[⪻($x,$y)⪼]≫"
@insert "≪Curve $curve_name x_values=[⪻ $x ⪼] y_values=[⪻ $y ⪼]≫"
Maybe a function is better suited than macros.
If it is possible in some form though, something like this, I think, is more readable than multiple split and join statements, or regex.
It would be easier if the required inputs / outputs were in a readable format like JSON or XML but this isn’t always the case.