At DDA, it is important to get good data from the user. Since Coldfusion is our preference for programming, we have many functions to validate data in form fields and strings. George Fuechsel coined the phrase, “Garbage in, Garbage Out”, because if bad information is processed, it would be unscientific to expect good results. Although that applies more to mathematical processing, it is important to let users know if something that they have entered doesn’t meet the criteria for that value. So, they may re-enter that specific information.
One practice is to use the Regular Expression functions built into Coldfusion, which can search for patterns in strings. The Regular Expression functions are REFind, REFindNoCase, REReplace, and REReplaceNoCase. REFind and REFindNoCase functions both take a Regular Expression, a string, and an optional start position and an optional return sub expression. They both return the start expression of where the string is first matched. The only difference is that REFind is case-sensitive and REFindNoCase is case-insensitive. REReplace and REReplaceNoCase both require another parameter to replace the location that the Regular Expression matches. When creating strings of Regular Expressions, you can help validate emails, phone numbers, zip codes, hexadecimal numbers, variables, usernames, and more.