D
D
Diversia2017-08-25 09:45:21
PHP
Diversia, 2017-08-25 09:45:21

How to use a regular expression to get what you want after a character?

Please tell me there is a link


http://***.ru/***/series1
http://***.ru/***/series1/ (may be at the end with a slash)

How to get the value after the last slash (namely the last one)
series1

?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav B, 2017-08-25
@Diversia

preg_match('/([^\/]+)\/?$/', "http://sdfsdf.ru/sdfsd/series1/", $m);
var_dump($m);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question