Closed DokterKaj closed 1 month ago
Close #1004 as well
You can use (?:) to not capture the match.
I'm purposely capturing (and using) the match since there's no good way to detect both an optional subdomain without the dot and the presence of redd.it
using only positive lookaheads
e.g. /^(?:(?:(?:external-)?preview|i)\.)?(?=\.redd\.it)/
keeps the dot and /^(?:(?:(?:external-)?preview|i)(?=\.))?(?=redd\.it)/
doesn't work
Closes #991.
subdomain[1]
will beundefined
when there is nothing beforeredd.it
in the string but since there's nothing else to test I just made itdefault
. To be rigorous it can be changed tocase undefined
though