[thelist] RegEx Fun

Raymond Camden jedimaster at macromedia.com
Fri Jan 4 19:01:56 CST 2002


> [[:space:]] means "A space-type character"
> [^[:space]] means "NOT a space-type character"
> [[:alnum:]*] means "Keep going until you hit something that isn't
> alphanumeric"
> 
> <tip type="ColdFusion Regular Expressions">
> The POSIX classes are covered in the CF documentation, but what isn't
> documented is how to use ascii character values, which is 
> important if you
> are ever going to be working with line breaks:
> [^[:cntrl:]13]* means "Keep going until the end of the line"
> </tip>
> 

Something else not in the docs - [[:blank:]] 

:blank: is space & tab, while :space: is :blank: + line breaks

To see this in action:

<CFSAVECONTENT VARIABLE="Test">
This is Raymond Camden
This is another test
Line 3
</CFSAVECONTENT>

<CFSET T1 = REReplace(Test,"[[:space:]]","","ALL")>
<CFSET T2 = REReplace(Test,"[[:blank:]]","","ALL")>

<CFOUTPUT>
<PRE>
T1=
#T1#
T2=
#T2#
</PRE>
</CFOUTPUT>





More information about the thelist mailing list