正则表达式匹配字符串的前三个字母,该字母必须是12个字符长和大写

I need some pointers with some regex voodoo - I just don't use them enough day to day to be familiar with them.

I'm processing a string containing multiple words and need to look for a reference number.

The ref number is in the format LCSYK89HE4W4 . 'LCS' is always constant, the Ref is always 12 chars long. The rest of the ref is made up from random uppercase alphanumeric chars.

Examples:

LCSJKIIU786T
LCS5YU87TFR4
LCSKIJ5R67DE

Any pointers would be much appreciated.

Thanks Sam

Use the following regex

LCS[0-9A-Z]{9}

Using this string however, it happens that a line containing additional characters before and after will not be rejected. If the string should begin and end with the ref number, use

^LCS[0-9A-Z]{9}$

You can test the regex here http://phpregextester.com/ (use /LCS[0-9A-Z]{9}/)