Version 2.5 of our technology includes a function to determining the length of a string (unsurprisingly called 'length') and a function to get an arbitrary part of a string (called 'substring').
In version 2.4 you have to use Java as Michel suggests.
I think such problems are the easiest to solve by writing a Java function for it. If you are familiar with them, i suggest the usage of regular expressions for this kind of problems, see this thread:
There are other string functions that would be useful -
LENGTH(string) - return length of string LEFT(string,nn) - return nn left side characters RIGHT(string,nn) - return nn right side characters LPAD(string, 'xxx', nn) - left pad a string to length nn with characters xxx RPAD(string, 'xxx', nn) - right pad a string to length nn with characters xxx
you can use length(AttributeName) <= 4