I have a url, – “http://example.com/sales/view/id/705” and I need get a last segment (705).
How can I do this using PCRE?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(In PHP) I would not use PCRE for such a trivial and un-ambiguous job. I would just do:
EDIT
If you need to use PCRE (although I don’t know why you would) this variation on eugene y’s answer would do it: