First off, A-z
gives you too wide of a range. In ASCII (and Unicode) there are characters between uppercase 'Z' and lowercase 'a' that are not letters or numbers. You can use the regex escape sequence \w
for word characters or A-Za-z
. Both are equivalent.
Also, it looks like you know you'll always have three sections so the lazy indicators are unnecessary.
[A-Za-z\d]+([-_\\/])[A-Za-z\d]+\1[A-Za-z\d]+\s*
This will ensure you have the same separator which can be a hyphen, slash, or underscore. Whatever the separator is it will separate 3 groups of alphanumeric characters.
Is this what you're looking for?