John,

Your assumption is correct. The part that may have confused you originally
is that POSIX-style character classes (ie, [:punct:]) are surrounded by
brackets and colons, in addition to the bracket set that defines the entire
character class, such as [[:alpha:][:punct:][:cntrl:]] etc...

Numeric charcter classes are special in that you can use a hyphen for any
range of numbers, such as [0-9], [0-3], [3-7], etc. which emcompass every
number in that specific range.

Dain Anderson
Caretaker, CF Comet
http://www.cfcomet.com/



----- Original Message -----
From: "John Barleycorn" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, July 27, 2001 1:39 AM
Subject: Re: Regular Expression Help


> Dain, thank you very much. Is it safe to assume then that anything else i
> want to search for can be added by placing the definition inside another
> pair of brackets?
>
> REFindNoCase("[[:Alpha:][0-3][ ][:Punct:]]", myString)
> (added [0-3] and [ ] to find a space)
>
> thanks.
>
> >From: "Dain Anderson" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: CF-Talk <[EMAIL PROTECTED]>
> >Subject: Re: Regular Expression Help
> >Date: Thu, 26 Jul 2001 21:02:45 -0400
> >
> >John,
> >
> >You almost had it (too many brackets):
> >
> ><cfif REFindNoCase("[[:Alpha:][:Punct:]]", myString)>
> >  Alpha characters or punctuation were found.
> ><cfelse>
> >  No alpha characters or punctuation found.
> ></cfif>
> >
> >If you need to get the position of the first occurance of these
characters,
> >use subexpressions:
> >
> ><cfset mystring = "1234.ABCD">
> >
> ><!--- Use the 'returnsubexpressions' parameter to get the position --->
> ><cfset something = REFindNoCase("[[:Alpha:][:Punct:]]", myString, 1,
> >"True")>
> >
> ><cfif something.pos[1]>
> ><cfoutput>
> >  Characters found at position: #something.pos[1]#<BR>
> ></cfoutput>
> ><cfelse>
> >  No alpha characters or punctuation found.
> ></cfif>
> >
> >Dain Anderson
> >Caretaker, CF Comet
> >http://www.cfcomet.com/
> >
> >
> >
> >----- Original Message -----
> >From: "John Barleycorn" <[EMAIL PROTECTED]>
> >To: "CF-Talk" <[EMAIL PROTECTED]>
> >Sent: Thursday, July 26, 2001 6:42 PM
> >Subject: Regular Expression Help
> >
> >
> > > Hello, i'm having some trouble using regular expressions. i read the
> >book
> > > and looked up examples, but unfortunately, i can't seem to solve my
> >problem.
> > > i've written code that checks to see if there is either a letter or a
> > > punctuation mark in a string, but it's not returning results properly.
> > > here's the code:
> > >
> > > <cfset something = REFindNoCase('[[:Alpha:]][[:Punct:]]', myString)>
> > >
> > > and my return value is always zero. can anyone tell me how this should
> >be
> > > written so that i works? thanks for your help.
> > >
> > > oh, forgot one thing, i also need to check to see if there are any
> >spaces
> > > inside the string. that's something i also don't know how to do.
thanks
> >a
> > > lot.
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to