I need to grab the 2 character letter and numbers after that:
What I want is:
AB 12 CD-12345-67 -> CD-12345
AB12 CD 12345-67 -> CD 12345
AB-12CD12345-6 -> CD12345
ABC1234556 -> no match, as I look for 2 character letter and numbers after that.
ABC-1234556 -> no match, as I look for 2 character letter and numbers after that.
A1-BC-12D345-56 -> no match, after 2 characters letter, numbers must come
I used this regex
[A-Z]{2}[ |\-]?\d+
Which grabs CD-12345 and AB 12, in the first example. I just need CD-12345. Also it grabs BC1234556,BC-1234556, BC-12 in the last three example which i don't want. Sometimes, space,no space or - character placed between numbers and letters block.
Thank you very much.