How to use regex to extract string

Hi , can I ask help how can I extract the string,

I have this string paths and I’m looping on it, and I want to cut this string “/save/manage”


so that I can get this string

Thank you in advance

what is “this string”? the last 5 characters? substr(). The forth slash? strpos() with substr(). Two characters before and after the last slash? Same as before. Or explode().

Do you mean substr($string, -5);
That will get the last 5 characters from a string, in this case 01/01

Nope, because when my loop runs the string sometimes would look something like this “/save/manage/02” , so I need to cut the “/save/manage/” so that I can output 02

So the “/save/manage/” part of the string is consistent always?
That could be done with a simple str_replace() or substr() again, since the length (of the part to remove) is the same.

1 Like

How EXACTLY are they stored? In a database?