This should work:
if(lNameStrc.len[1]) {
On failuare, lNameStrc.len(and pos)[1] == 0.
=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
Email : [EMAIL PROTECTED]
Yahoo IM : morpheus
"My ally is the Force, and a powerful ally it is." - Yoda
> -----Original Message-----
> From: Jamie Jackson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 31, 2002 12:19 PM
> To: CF-Talk
> Subject: Proper way to check for successful subexpression match?
>
>
> Hi,
>
> What needs to be in place of "whatGoesHere" in the following code
> block? I'd like to know the proper way to determine whether or not my
> subexpression was matched. If you just refer to the structure elements
> pos and len, when there is no match, CF throws an error.
>
> // find pattern and return subexpressions
> lNameStrc = refind('([^ ]+)$', name, 1, 'true');
>
> // if subexp was found, set var. otherwise set var to bogus val
> if (whatGoesHere???) {
> lName = mid(name, lnameStrc.pos[2], lnameStrc.len[2]);
> } else {
> lName = '1029384756XXX';
> }
>
>
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists