/^ # match the start of the line [A-Z0-9]{3,} # match at least 3 alnums, beginning at the start of the line $ # match the end of the line -- we've only matched alnums /xi;