In general, there is a URL of the form: www.site.ru/topic/id (id = any number or set of numbers) And you need to pull out with the help of regexp this very ID. Tell me, please, regulars) Thanks in advance.

  • Thx, it helped. - Folleah

2 answers 2

Because the dialect is not specified, I will give POSIX Basic RegEx:

\([0-9]*\)$ 

Correspondingly, in \1 will be the id you are interested in.

     www.site.ru/\w+/(\d+) 

    Or easier, without www.site.ru

     /(\d+)$ 
    • How can it be easier? Without entering www.site.ru, just take the last element after the slash into a variable. - Folleah