Problem with that approach Is that each WHOIS output is different for each
TLD, and there are multiple dates on the page, and the expiry date or
whatever I want to extract will be in a different format.

I gave Spikes code a try for the HELL of it and strangely that did parse all
the chr(10) chars, so it must just be the Find() function that fails on
that, learn something new every day.
Anyway I have resorted back to good old fashioned string manipulation
functions after using listtoarray() to extract all the lines as per Spikes
example and it all works fine now.
I now have a handy dandy component for doing whois lookups and extracting
specific info from them.

In case your wondering why I would want to do this, it is to update our
domains database with the current expiry dates and contact info for each
domain.
 

Russ Michaels           

-----Original Message-----
From: Caroline Wise [mailto:[EMAIL PROTECTED] 
Sent: 29 July 2005 19:47
To: CF-Talk
Subject: Re: regex

Russ,

If I understand correctly, this might be of help:

<cfset teststring = "aa bbb ccc e ff aa 01-Dec-2001 ddd dddd ddd
02-May-2006 eeeee eeeeee eeee">
<cfset start = 1>
<cfset regex = "\b[0-9]{2}-[A-Za-z]{3}-[0-9]{4}\b">

<cfloop condition="#REFind(regex,teststring,start)# gt 0"> <cfoutput>
#Mid(teststring,REFind(regex,teststring,start),11)#<br>
</cfoutput>
<cfset start = REFind(regex,teststring,start)+1> </cfloop>

The regular expression is based on that you have a dd-mmm-yyyy pattern. Then
you loop over your file content until it runs out of "hits".

Best of luck,
Caroline Wise




On 7/29/05, Russ Michaels <[EMAIL PROTECTED]> wrote:
> I did try something along those lines originally, but CF doesn't seem 
> to be able to pickup the chr(10) or chr(13)
> 
> 
> Russ
> 
> -----Original Message-----
> From: Spike [mailto:[EMAIL PROTECTED]
> Sent: 29 July 2005 18:03
> To: CF-Talk
> Subject: Re: regex
> 
> You don't need to use a regex to get that info out of the whois output.
> 
> <cfset aLines = listToArray(whoisInfo,chr(10)) /> <cfset expiryLine = 
> "" /> <cfloop from="1" to="#arrayLen(aLines)#" index="i"> <cfif 
> findNoCase("Expiration Date",aLines[i])> <cfset expiryLine = aLines[i] 
> /> <cfbreak> </cfif> </cfloop>
> 
> <cfif len(expiryLine)>
> <cfset dateString = listLast(expiryLine,":") /> <cfset expiryDate =
> parseDateTime(dateString) /> <cfoutput>#expiryDate#</cfoutput> </cfif>
> 
> Spike
> 
> On 7/29/05, Russ Michaels <[EMAIL PROTECTED]> wrote:
> >
> > While that tag looks very handy, it doesn't write the REGEX for you, 
> > you still have to supply the REGEX to the tag for it to find the 
> > text your looking for.
> >
> >
> > Russ
> >
> > -----Original Message-----
> > From: Claude Schneegans [mailto:[EMAIL PROTECTED]
> > Sent: 29 July 2005 17:22
> > To: CF-Talk
> > Subject: Re: FW: [CF-Dev] regex
> >
> > >>I need to extract data from WHOIS output.
> >
> > Have a look a CF_REExtract:
> >
> > http://www.contentbox.com/claude/customtags/REextract/testREextract.
> > cf
> > m?p=hf
> >
> > It has especially developed for this king of job.
> >
> > --
> > _______________________________________
> > REUSE CODE! Use custom tags;
> > See http://www.contentbox.com/claude/customtags/tagstore.cfm
> > (Please send any spam to this address: [EMAIL PROTECTED])
Thanks.
> >
> >
> >
> >
> >
> 
> 
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213300
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
  • Re: regex Caroline Wise
    • RE: regex Russ Michaels

Reply via email to