I had to do a password validation in ColdFusion and learnt a few functions of regular expressions in ColdFusion.
REFind – Used to check if a particular string confines to a regular expression. If the string is in the regex format mentioned it returns the starting location of the REGEX of that string.
REReplace – Used to replace the particular regular expression in a string.REFind("regular expression", "String", "returns")
Where scope is : one – change the first occurrence of the regex, all – change all the occurrences.REReplace("String", "regularExpression", "SubString", "Scope")
ColdFusion has a set of character classes defined which can be used instead of creating the regular expressions explicitly.
:alpha: All alphabets is equivalent to [A- Z][a- z] . The set of all character classes can be found here at the very end.
No comments:
Post a Comment