I'm trying to match a hostname similar to foo-bar3-vm.companyname.local
. The part that is foo-bar3
can be any combination of letters, numbers, and hyphens, but I want to ensure it ends in -vm.companyname.local
.
I was attempting to use /^[a-zA-Z0-9\-]*[vmVM]*\.companynanme\.local$/
, but that seems to match anything ending in .companyname.local
.
What's wrong with my regex?