Hi
I have the following urls:
www.localhost.com
localhost.com
test.localhost.com
How would I match match www or nothing in a regex?
Thanks, Andy
Hi
I have the following urls:
www.localhost.com
localhost.com
test.localhost.com
How would I match match www or nothing in a regex?
Thanks, Andy
If I understand your question correctly, you need to use a lookahead, like this:
/^www(?=\.localhost.com)/
This will match www
if and only if it's followed by .localhost.com
.
If that's not what you're trying to do, please clarify.