A more general answer which accepts all the special characters including _
would be slightly different:
^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[\W|\_])(?=\S+$).{8,}$
The difference (?=.*[\W|\_])
translates to "at least one of all the special characters including the underscore".