How can I validate the last digits of URL /?d=123
the URL will always ends with /?d=(no more than 4 numbers) ex.12345 will never appear
http://www.test.com/?d=123
This is what i have, but I don't know how to match just the ones that end with 123 and 4321
(http(s)?://)([\w-]+\.)+[\w-]+(/[\w- ;,./?%&=]*)?
/^\d+$/.test( url.split('=').pop() )/(\d+)/gto get the numbers back. But this is a very loose regex.