RegEx – allow whitespace at start and end of the string with fixed length

Currently I am working on a regex with the following conditions:

  • Can accept whitespace at start and end of the string
  • Can accept hyphen in mid/end of the string
  • Length of the characters should not be more than 10 and less than 8 (excluding spaces)

I have created below regex but somehow length validation is not working as expected.

(^s*?)((?!(-))([0-9-]*)){8,10}(s*?)$
https://regex101.com/r/aJNmqj/1