The format of Url is - https://example.com/items/html5-templates/654321
- Firstly I want to take the link without last numbers. e.g: https://example.com/items/html5-templates/
And,
- Secondly, want to take only the last part (numbers) from the link. e.g: 654321
I need to get the regex code for using in a auto Parse plugin to my wp site,,,
And then I can customise the link as Like:
https://.....(link without last part)...../...anything..../...(only last numbers from the link format)...
Thanks a lot for your precious time,,,
CodePudding user response:
Try something like this:
^(.*/)(\d )$
The first part of URL will be in first capture group, and second capture group will be numbers.
CodePudding user response:
use str.replace(/\/\d $/, '') to remove /86886866 from string like https://www.wexperts.xyz/32423 The result will be like https://www.wexperts.xyz