You need to double all the backslashes:
(?=^.{8,21}$)((?=.*\\d)|(?=.*\\W))(?![.\\n])(?=.*\\p{L})
Also, I'm not sure of that regex makes much sense. Is this really what you want:
(?=^.{8,21}$) # Assert length 8-21 characters (why only 21?)
( # Group 1:
(?=.*\\d) # Assert at least one digit in the string
| # OR
(?=.*\\W) # at least one non-alnum character in the string
) # End of group 1
(?![.\\n]) # Assert that the *first* character isn't a dot or newline (??)
(?=.*\\p{L}) # Assert at least one letter in the string