How to get the number after particular string from array of strings using javascript?

below is an array of strings.

const arr = [
    "list/1/item/1/",
    "item/2/",
    "item/3/subitem/2/",
    "item/4/subitem/3/someother/5",
]

now i have to filter strings that has string starting with item/1/ and is not followed by any other string or is ending with string item/1/

so the expected filtered array is like below,

const filtered_array = [
    "list/1/item/1/",
    "item/2/",
]

from this filtered array i want to get only the number after item/ so the expected output is

const ids = ["1","2"]

i have tried below

var output = arr.filter(x => x.match(/^item/d+|bitem/d+/$/))
            .map(x => x.match(/(?<=^item/)d+|(?<=bitem/)d+(?=/$)/)[0]); //error 
            //here

this gives output like below

const output = ["1", "2", "3", "4"]

because this matches also strings “item/3/subitem/2/”,
“item/4/subitem/3/someother/5”,

how can i fix this regex to match only strings starting with item/3/ and not followed by any other string or is ending with item/3/

also i get object is possibly null on map match line. could someone help me fix this. thanks.