08-03-2022 01:28 AM
Hi all,
I am trying to get the value between the ‘()’ of every record inside the array.
[
{ “betroffene IT Systeme”:[
“Ardoq·(431)”
“SnapLogic·(580)”
]
}
]
So that I get an array:
[ {
“betroffene IT Systeme”:[
“431”
“580”
]
} ]
My expressions language is still a bit rusty…
Solved! Go to Solution.
08-03-2022 02:37 AM
Hi,
You can use the below expression.
$[‘betroffene IT Systeme’].map(x => x.substring(x.indexOf(“(”)+1, x.indexOf(“)”)))
08-03-2022 02:37 AM
Hi,
You can use the below expression.
$[‘betroffene IT Systeme’].map(x => x.substring(x.indexOf(“(”)+1, x.indexOf(“)”)))
08-03-2022 05:08 PM
This also works and seems a little easier to understand. Instead of searching for the indexes of the open and close parenthesis and using a substring, it just removes everything that isn’t a numeric value. Great solution provided by nsingam, but in the spirit of offering you options, I thought I would share this one with you too. Definitely there are more than 1 way to skin a cat (horrible expression).
$[‘betroffene IT Systeme’].map(x => x.replace(/[^0-9]/g, ‘’))
08-03-2022 10:36 PM
Thank you for your answer, much appreciated. That I haven’t tought about that also. Because I always only need the numbers.
Regards
Jens