This is so simple!! Have you really tried anything?? If you want to match a string containing lowercase letters, digits and hyphen, you can use:
[a-z0-9-]
If you strictly want to match the above pattern, then:
(([a-z0-9]+)(-)?)+
should work. It means any alphanumeric folled by one or zero hyphen.
I am not sure if for hyphen we need to use /- instead of - directly :D. So atleast do this by yourself and let me also know :D.
[a-z0-9-]+ will also work for you, but it will also accept strings of type:
adcacf--sadcac-das-----
and even this will also be accepted:
------------- (strings of hyphen)
So, if you know that you won't get these type of strings, then you may go with [a-z0-9-]+ as told by PVR.
^[0-9a-z]{8}-([0-9a-z]{4}-){3}[0-9a-z]{12}$-s at specific locations in the string, note that the OP says: "caracter [sic]-can appear anywhere". The comments on Bathsheba's answer confirm this further.