In the following string how to get the id after the directory media and after getting the id ignore the rest of the string to read only the id numbers
id_arr= ["/opt/media/12/htmls","/opt/media/24/htmls","/opt/media/26/htmls","/opt/media/56/htmls"]
The output should be 12 24 26 56