Okay, should we call you Benjamin "little tricks" Bloodworth? Keep those little tricks coming...
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Bloodworth Sent: Tuesday, September 25, 2007 11:32 AM To: discussion@acfug.org Subject: RE: re[2]: [ACFUG Discuss] Finding numbers in strings Thanks for the comments. I can't take all the credit though. The coldfusion function is what builds the array. You just have to know the little tricks to get it to return it, like putting parentheses in your regular expression and true as the 4th argument. Benjamin Bloodworth [EMAIL PROTECTED] 850.702.0052 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Kaufman Sent: Tuesday, September 25, 2007 2:23 PM To: discussion@acfug.org Subject: RE: re[2]: [ACFUG Discuss] Finding numbers in strings Benjamin, that is an excellent--and educational--response. I was only following the thread of this post "in the background" and hadn't thought of using an array. Your solution is simple and adaptable. Good work. Dan K -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Bloodworth Sent: Tuesday, September 25, 2007 10:12 AM To: discussion@acfug.org Subject: RE: re[2]: [ACFUG Discuss] Finding numbers in strings <cfset MyString = "ATTN: JOE SMITH PO## 72274"> <cfset MyNumbersArray = REFindNoCase("([0-9]+)", MyString, 1, true)> <cfoutput> #Mid(MyString, MyNumbersArray.pos[1], MyNumbersArray.len[1])# </cfoutput> That would return the number in the string. The parentheses is the regular expression groups the result. The + indicates one more numbers in a row. The number 1 is where to start the search. True tells cf to return subexpressions. MyNumbersArray.pos[1] indicates where the string starts. The .pos property is returned when you tell the regular expression to return subexpressions. MyNumbersArray.len[1] indicates how long the number string is. Using those two values and mid, you can return the number. Benjamin Bloodworth [EMAIL PROTECTED] 850.702.0052 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mischa Uppelschoten ext 10 Sent: Tuesday, September 25, 2007 11:40 AM To: Web Site Subject: re[2]: [ACFUG Discuss] Finding numbers in strings Thanks Ben! I'm not a RE wiz, so I'm not sure I understand why REFindNoCase("[0-9]", "ATTN: JOE SMITH PO## 72274"); results in "22"... ? : REFindNoCase("[0-9]", MyString) : You may have to play around with the regular expression some to get exactly : what you want, but that should get you started. : Benjamin Bloodworth : [EMAIL PROTECTED] : 850.702.0052 : -----Original Message----- : From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mischa : Uppelschoten ext 10 : Sent: Tuesday, September 25, 2007 11:20 AM : To: Web Site : Subject: [ACFUG Discuss] Finding numbers in strings : I thought I once saw a function in CF that would find a numeric part : anywhere in a string, but I can't find it anymore (or was I dreaming?) : Anyway, here are some sample strings I need to parse: : "ATTN: JOE SMITH PO# 72274" : "3150 holcomb bridge road" : " PO# 72049" : " 6311 COURT ST." : "PO's 72993, 73252,73211" : What I'd like to find in a string: : - does the string contain a number larger than 72000 and smaller or equal to : 999999? : - if yes, does the string contain the letters "po" : - if yes, return the string from "po" until the end : - if no, return the string : Background: sometimes our customers put our Purchase Order number(s) (which : range between 72000 and 999999) in the address fields of a UPS label and : it's hard to find when the bill comes, so any parsing I can do here, will : help our AP folks a lot. : Thanks! : /m : ------------------------------------------------------------- : Annual Sponsor FigLeaf Software - http://www.figleaf.com : To unsubscribe from this list, manage your profile @ : http://www.acfug.org?fa=gin.edituserform : For more info, see http://www.acfug.org/mailinglists : Archive @ http://www.mail-archive.com/discussion%40acfug.org/ : List hosted by http://www.fusionlink.com : ------------------------------------------------------------- : No virus found in this incoming message. : Checked by AVG Free Edition. : Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 : 8:02 AM : : No virus found in this outgoing message. : Checked by AVG Free Edition. : Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 : 8:02 AM : : ------------------------------------------------------------- : Annual Sponsor FigLeaf Software - http://www.figleaf.com : To unsubscribe from this list, manage your profile @ : http://www.acfug.org?fa=login.edituserform : For more info, see http://www.acfug.org/mailinglists : Archive @ http://www.mail-archive.com/discussion%40acfug.org/ : List hosted by http://www.fusionlink.com : ------------------------------------------------------------- Mischa Uppelschoten The Banker's Exchange, LLC. 2020 Hills Avenue NW Atlanta, GA 30318 Phone: (404) 605-0100 ext. 10 Fax: (404) 355-7930 Web: www.BankersX.com Follow this link for Instant Web Chat: http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN ---------- Original Message ---------- FROM: "Benjamin Bloodworth" <[EMAIL PROTECTED]> TO: <discussion@acfug.org> DATE: Tue, 25 Sep 2007 11:23:45 -0400 SUBJECT: RE: [ACFUG Discuss] Finding numbers in strings REFindNoCase("[0-9]", MyString) You may have to play around with the regular expression some to get exactly what you want, but that should get you started. Benjamin Bloodworth [EMAIL PROTECTED] 850.702.0052 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mischa Uppelschoten ext 10 Sent: Tuesday, September 25, 2007 11:20 AM To: Web Site Subject: [ACFUG Discuss] Finding numbers in strings I thought I once saw a function in CF that would find a numeric part anywhere in a string, but I can't find it anymore (or was I dreaming?) Anyway, here are some sample strings I need to parse: "ATTN: JOE SMITH PO# 72274" "3150 holcomb bridge road" " PO# 72049" " 6311 COURT ST." "PO's 72993, 73252,73211" What I'd like to find in a string: - does the string contain a number larger than 72000 and smaller or equal to 999999? - if yes, does the string contain the letters "po" - if yes, return the string from "po" until the end - if no, return the string Background: sometimes our customers put our Purchase Order number(s) (which range between 72000 and 999999) in the address fields of a UPS label and it's hard to find when the bill comes, so any parsing I can do here, will help our AP folks a lot. Thanks! /m ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=gin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=gin.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.30/1030 - Release Date: 9/25/2007 8:02 AM ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------