I will explain the expression '/^[A-Z0-9]\S.+$/' ^[A-Z0-9] the start of the string is a letter A-Z or digit 0-9 \S the second character in the string is not a white space type .+$ any character 1 or more times till end of string because we are not striping the padding from the inbound variable this will match any string of more than 1 character even though it seems to imply an excepted length or three or more and not 2 or more. In order to accept these cases with embeded spaces I would modify the expression to the following. prxmatch('/^[A-Z0-9].{1,}$/',strip(id)) ^[A-Z0-9] the start of the string is letter A-Z or digit 0-9 .{1,}$ followed by any character (except new line) 1 or more times without the strip function on the inbound variable id the strings will be padded and match for length even though they may not be more that 1 character long. data foo(where=(prxmatch('/^[A-Z0-9].{1,}$/',strip(id)))); infile cards truncover; input @1 id $10.; cards; 1234-A35 1234567-d45 e453768 1 A123 A 123 A 123 *123456789 *12345 ; run; 1234-A35 1234567-d4 A123 A 123 A 123 like previous to make the expression not case sensitive '/^[A-Z0-9].{1,}$/i' will capture the additional id e453768. This expression is also the same as /^[A-Z0-9].+$/ + means repeat previous statement 1 or more times {n} means repeat exactly n times {n,m} means repeat n to m times {n,} means repeat n or more times so + and {1,} are the same...
... View more