I need a regular expression for which:
the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4 cha
^[a-zA-Z0-9]{6}(-[A-Za-z0-9]{1,4})?$