Regex to get reddit comment/submission ID from permalink code example
Example: Regex to get reddit comment/submission ID from permalink
// EX https://old.reddit.com/r/hardware/comments/nv4h5d/amd_announces_radeon_pro_w6800_and_w6600_rdna2/
// first capture group returns 'nv4h5d'
const SUBMISSION_URL_ID = /(?:^.+?)(?:reddit.com\/r)(?:\/[\w\d]+){2}(?:\/)([\w\d]*)/g;
// EX https://old.reddit.com/r/hardware/comments/nv4h5d/amd_announces_radeon_pro_w6800_and_w6600_rdna2/h11cohw/
// first capture group returns 'h11cohw'
const COMMENT_URL_ID = /(?:^.+?)(?:reddit.com\/r)(?:\/[\w\d]+){4}(?:\/)([\w\d]*)/g;