How to insert into a cell part of tex from another cell

If I have in cell text “80/40/180” I need to insert into the other cell text, that is between “/s” (“40”). How do i do that? What formula i need to use?

"80/40/180"    >    40
"120/880/20"     >     880

Thank you.

one of:

=REGEX(A1; "^.*?/(\d+)/.*$" ; "$1" )


@karolus please explain your =REGEX() structure so that i know how it works

or using an Excel-compatible trick:

=TRIM(MID(SUBSTITUTE(A1; "/";REPT(" ";100));101;100))

There’s a good tutorial:

Specifics concerning the ICU “Regex flavor” used by LibreOffice you find here:

A “positive” alternative: =REGEX(A1;"(?<=/)\d+(?=/)";;1)

98450.ods (15.2 KB)