>Yes, either of those should be equivalent. You may want to also add a ^ to the beginning and a $ to the end to ensure the matched string is from a single word and not a substring of a larger word. Depending on what you are doing with the regex, the parenthesis may also be unnecessary. They will store off those substrings as a match that can be retrieved later or used in a replace. If you are using the matching groups, you don't need them.
I am not aware of the ^ and $ characters. Can you give me an example of what it would give with the inclusion of those characters in that expression as per what you say:
([A-Za-z0-9]{1}[A-Za-z0-9-]{19})-([A-Za-z0-9]{1,12})
On that one, I have scaled it down to the following validations:
Accept alphanumeric characters at position 1
Accept alphanumeric characters or a dash for the next 19 characters
A dash is mandatory
The dash can only be from position 2
After the dash, only alphanumeric characters are accepted for a maximum of 12 characters