I’m looking for a pattern that match with
"changes": [
"5.12.0",
"5.14.0"
],
...
"changes": [
"1",
"5.0.0",
"5.10.1"
],
...
"changes": [
"4.4",
"5.0.0",
"5.10.1"
],
I’m no expert, I’ve tried maybe 40 or 50 different solutions, here’s my last try:
/"changes": [s*("([0-9](.+))*"(,+))*s*],/
i try this one and it works, ty.
"changes": [s*("([0-9](.+))*"(,+)s )+("([0-9](.+))*"s)],
2
Answers
sorry if i dont clarify, i have a json with 3 000k lines, with a big array of object and i want to delete all changes versions of any object.
the solution is :
thank you ! i spend 4 hours this morning and i found some minutes after asking :(
I would do it in two steps:
Search for the list of versions between the brackets after "changes":
/"changes":s*[s*([^]]+)s*]/gs
: https://regex101.com/r/XHaxJ0/1For each match, you’ll get the list of versions in the capturing group 1:
You can then extract each version with
/[d.]+/g
: https://regex101.com/r/XHaxJ0/2The Javascript code:
EDIT since question has changed
As you just want to delete the "changes" entries, I would do the
following: