Why this regex is not working? : Test URL:

    www-test1.examples.com

The regex should match -test1 part and only if it is before the first dot and after the start of the expression. www can be any string.

Following is m regex:

    ^(?= \w+)(-\w+)(?! \.)

This is not matching the -test1 part. What am I missing in regex? Thanks in advance for the help.