Trim characters from a cell reference

Hello again, all. I’m having a mental block today and was hoping someone could help out. I have a column in my spreadsheet that contains a path and filename (e.g, /home/grey/Documents/LOWriter/filename.ods). To be clear, this column contains text and not references/hyperlinks to the files. I would like to trim the text down to “filename.ods” in an adjacent column. What would be the correct function/formula to do so?

I know one of you geniuses know! :laughing: Thanks!


you may use: =REGEX(A1;"[^/]+(?=$)") assuming your filename is in cell A1.

Hop that helps.

The positive lookahead (?=$) is correct but not needed, the simple end anchor $ does as well, so =REGEX(A1;"[^/]+$")

@erAck - of course you are right. This solution was just a slight modification of a more general solution, which also allows for removing table names at the end of the filename using ...(?='#\$)

We have a WINNER! Thanks @Opaque and also @erAck for your speedy answer(s). What would I do without you? :grinning_face_with_smiling_eyes: :heart_decoration: