Open catull opened 6 months ago
In issue https://github.com/schibsted/jslt/issues/340 I had to resort to 2 nested replace calls.
replace
replace ( replace (text, ",]", ]), ",}", "} )
I wanted to collapse the two nested calls into one. Both patterns start with ,, one ends with }, while the other ends in ].
,
}
]
It would be great if this was supported:
replace (input, ",([}\])", "$1")
This way, ,} would result in }, and ,] would become ']'.
,}
,]
Or think of the eternal battle of date formats, ISO vs US format vs European.
def isoDateToUS (date) replace (date, "(\d\d\d\d)-(\d\d)-(\d\d)", "$2/$3/$1" def isoDateToEuropean (date) replace (date, "(\d\d\d\d)-(\d\d)-(\d\d)", "$3/$3/$1"
I am not going to suggest that this be supported in this issue:
def isoToUSformat (date) replace (date, "(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})", "${month}/${day}/${year}")
This issue can be seen as an extension of #346, I realize it now.
In issue https://github.com/schibsted/jslt/issues/340 I had to resort to 2 nested
replace
calls.I wanted to collapse the two nested calls into one. Both patterns start with
,
, one ends with}
, while the other ends in]
.It would be great if this was supported:
This way,
,}
would result in}
, and,]
would become ']'.Or think of the eternal battle of date formats, ISO vs US format vs European.
I am not going to suggest that this be supported in this issue: