I have random strings in the form of K1/ABC/J/123456/2020/O, A4/ABCD/J1/2123456/2022/Ok etc. They are always 5x “/”.
I need a redex function to suppress the last suffix (so everything after /d{4}/).
On the example of the above examples, as a result of the function I should get: K1/ABC/J/123456/2020 and A4/ABCD/J1/2123456/2022.
All characters can be different, the number of “/” is constant.
Could I ask for help?
I beginner, please help me 🙂
$number = getActionNumber($data); // in this place i have: K1/ABC/J/123456/2020/O, A4/ABCD/J1/2123456/2022/Ok etc
$myNewNumberWithoutSuffix = ..... // here i need K1/ABC/J/123456/2020 and A4/ABCD/J1/2123456/2022