regexp help
Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254457 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
!--- Using java. --- cfset strTest = strTest.ReplaceAll( [_12]+, ) / !--- Using REReplace. --- cfset strTest = REReplace( strTest, [_12]+, , ALL ) / .. Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:16 PM To: CF-Talk Subject: regexp help Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254463 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regexp help
what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? REreplace (MyString, _|1|2, , all) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254469 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
rereplace(str, [12_],,ALL) ? On 9/27/06, Ray Champagne [EMAIL PROTECTED] wrote: Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254470 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254476 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
No practical difference. Ben took the shortcut of using a character set rather than explicitly stating the OR ( | ) condition. To be clear, though, either of these will remove any _, 1 or 2 from your value. So foo1bar will become foobar. If the chars to be removed must be at the end of the string you want to use: cfset strTest = REReplace( strTest, _?[12]+$, , ALL ) / I varied Ben's regex slightly, but the gist is still there. The key difference is that the $ forces the match to appear at the *end* of the string, not anywhere in the string. -- Rob Wilkerson On 9/27/06, Ray Champagne [EMAIL PROTECTED] wrote: Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254486 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
rereplace(str, '1|2|_', '', 'all') -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:16 PM To: CF-Talk Subject: regexp help Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254485 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: regexp help
Ray, I don't think there is any real difference. I am just grouping my characters [_12]+ and noting that at least one item (+) is required for the match. He is just listing them as being OR'd. Grouping [] inherently denotes OR. The | is an explicit OR. Also, if your example get's bigger, the | actually breaks the expression up. For instnace, if you wanted to add outlier characters such as getting rid of the above ONLY IF surronded by A and Z... My method would be: A[_12]+Z His method would be: A(_|1|2)+Z It's all a matter of personal taste I suppose. .. Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:54 PM To: CF-Talk Subject: RE: regexp help Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254489 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
Rob, Exactly, no real practical difference here. The only place it becomes more practical one way or the other is when the situation gets more complicated. For example, [] is used to group CHARACTERS... But ( | | ) can be used to group SUBSTRINGS ex. (ben is (cool|rad|awesome)) Such a grouping using [] would be a nightmare. .. Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -Original Message- From: Rob Wilkerson [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 3:07 PM To: CF-Talk Subject: Re: regexp help No practical difference. Ben took the shortcut of using a character set rather than explicitly stating the OR ( | ) condition. To be clear, though, either of these will remove any _, 1 or 2 from your value. So foo1bar will become foobar. If the chars to be removed must be at the end of the string you want to use: cfset strTest = REReplace( strTest, _?[12]+$, , ALL ) / I varied Ben's regex slightly, but the gist is still there. The key difference is that the $ forces the match to appear at the *end* of the string, not anywhere in the string. -- Rob Wilkerson On 9/27/06, Ray Champagne [EMAIL PROTECTED] wrote: Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254491 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
I don;t know that Claude's will work quite right. I think it will also remove the | character. The main difference is that Ben used the +, which says to replace 1 or more adjacent occurances with null. This should be marginally faster than not using the +, since is does them in groups. But you will probably never notice the difference given the size, data, and speed of the server. On 9/27/06, Ray Champagne [EMAIL PROTECTED] wrote: Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254487 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
Claude's (and mine) will work just fine. It won't replace the pipe since it isnt escaped. It will also replace 1 or more instances of any of the 3 characters -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 3:08 PM To: CF-Talk Subject: Re: regexp help I don;t know that Claude's will work quite right. I think it will also remove the | character. The main difference is that Ben used the +, which says to replace 1 or more adjacent occurances with null. This should be marginally faster than not using the +, since is does them in groups. But you will probably never notice the difference given the size, data, and speed of the server. On 9/27/06, Ray Champagne [EMAIL PROTECTED] wrote: Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254494 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
Ray, The notations are pretty similar. REReplace( strTest, [_12]+, , ALL ) This looks for any combinations of 1 or more combinations of _,1 or 3. It is a greedy notation. ReReplace (MyString, _|1|2, , all) This is more logical oriented meaning that _ or 1 or 2 exists, then remove it. The only problem with both of these is that they will get red of _,1 or 2 from anywhere in your string. You would need a different RegEx if you just want to remove trailing characters. Teddy On 9/27/06, Bobby Hartsfield [EMAIL PROTECTED] wrote: rereplace(str, '1|2|_', '', 'all') -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:16 PM To: CF-Talk Subject: regexp help Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254496 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
I meant to say: This looks for any combinations of 1 or more combinations of _,1 or 2. It is a greedy notation. instead of: This looks for any combinations of 1 or more combinations of _,1 or 3. It is a greedy notation. On 9/27/06, Teddy Payne [EMAIL PROTECTED] wrote: Ray, The notations are pretty similar. REReplace( strTest, [_12]+, , ALL ) This looks for any combinations of 1 or more combinations of _,1 or 3. It is a greedy notation. ReReplace (MyString, _|1|2, , all) This is more logical oriented meaning that _ or 1 or 2 exists, then remove it. The only problem with both of these is that they will get red of _,1 or 2 from anywhere in your string. You would need a different RegEx if you just want to remove trailing characters. Teddy On 9/27/06, Bobby Hartsfield [EMAIL PROTECTED] wrote: rereplace(str, '1|2|_', '', 'all') -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:16 PM To: CF-Talk Subject: regexp help Can some tell me what the regexp would be to remove all instances of _ or 1 or 2 (that's underscore OR one OR two) from a string? Like ffmpti_2 would become ffmpti or carfeed1 would become carfeed. Thanks ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254498 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: regexp help
Thanks Ben, Jerry, Claude, Rob. -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 3:19 PM To: CF-Talk Subject: RE: regexp help Importance: High Ray, I don't think there is any real difference. I am just grouping my characters [_12]+ and noting that at least one item (+) is required for the match. He is just listing them as being OR'd. Grouping [] inherently denotes OR. The | is an explicit OR. Also, if your example get's bigger, the | actually breaks the expression up. For instnace, if you wanted to add outlier characters such as getting rid of the above ONLY IF surronded by A and Z... My method would be: A[_12]+Z His method would be: A(_|1|2)+Z It's all a matter of personal taste I suppose. .. Ben Nadel Certified Advanced ColdFusion Developer www.bennadel.com -Original Message- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 2:54 PM To: CF-Talk Subject: RE: regexp help Ben, Claude, just so I know, what's the difference between your solutions? Is it merely more than one way to skin a cat, or is one better than another? cfset strTest = REReplace( strTest, [_12]+, , ALL ) / REreplace (MyString, _|1|2, , all) ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254497 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
Yeah, I read it as [1|2|_] within square brackets. My eyes playing tricks on my mind. On 9/27/06, Bobby Hartsfield [EMAIL PROTECTED] wrote: Claude's (and mine) will work just fine. It won't replace the pipe since it isn't escaped. It will also replace 1 or more instances of any of the 3 characters ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254503 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
what's the difference between your solutions? Technically, they do the same. Probabilly one is a couple of microseconds more efficient, but I can't even say which one. The range set [_12] is probabilly more elegant. The difference would be that with a range, you can only OR between characters, with the | OR operator, you could OR between strings. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254520 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regexp help
I think it will also remove the | character. No: the | is the OR operator. -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254521 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: More RegExp help...
And if the filename COULD contain other periods: listDeleteAt(filename,listLen(filename,.),.) which says, delete the last list item using . as list delimiter Scott Stroz wrote: I love RegEx, and use them frequently. However, they are not always my first choice. I would actaully use: ListFirst(fileName,.) Assuming there are no periods in the file name. This may actually be a bit quicker since you don't use the Reg Ex engine. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217957 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: More RegExp help...
Except he also needs to remove the _640x640 part. However, you could do the same thing with underscores instead of periods. --Ben Jann E. VanOver wrote: And if the filename COULD contain other periods: listDeleteAt(filename,listLen(filename,.),.) which says, delete the last list item using . as list delimiter Scott Stroz wrote: I love RegEx, and use them frequently. However, they are not always my first choice. I would actaully use: ListFirst(fileName,.) Assuming there are no periods in the file name. This may actually be a bit quicker since you don't use the Reg Ex engine. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217961 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: More RegExp help...
Good point...then I might consider this ListFirst(ListFirst(fileName,.),_) Again, this is assuming teh format of th efile name will not change.. On 9/12/05, Ben Doom [EMAIL PROTECTED] wrote: Except he also needs to remove the _640x640 part. However, you could do the same thing with underscores instead of periods. --Ben Jann E. VanOver wrote: And if the filename COULD contain other periods: listDeleteAt(filename,listLen(filename,.),.) which says, delete the last list item using . as list delimiter Scott Stroz wrote: I love RegEx, and use them frequently. However, they are not always my first choice. I would actaully use: ListFirst(fileName,.) Assuming there are no periods in the file name. This may actually be a bit quicker since you don't use the Reg Ex engine. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217974 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: More RegExp help...
I love RegEx, and use them frequently. However, they are not always my first choice. I would actaully use: ListFirst(fileName,.) Assuming there are no periods in the file name. This may actually be a bit quicker since you don't use the Reg Ex engine. -- Scott Stroz Boyzoid.com http://Boyzoid.com ___ Some days you are the dog, Some days you are the tree. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217872 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
More RegExp help...
Hey folks, I have a regular expression I need for the following: I have filenames that have the following appended to them: filename_100x100.png filename_640x480.png filename_86x86.png and so on I need to extract JUST the filename. The kicker is, the filename MAY include underscores, so I can't just search for that. I know I could do several finds on the different resolutions, but I also know there's got to be a nifty way with a RegEx to do it. Anyone want to take a stab at it? Thanks, Dave ** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, ALLTEL requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217859 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=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: More RegExp help...
rereplace(string, _[0-9]+x[0-9]+\.png, ); If the pixel size (I assume that's what the numbers are) is always a square, you might use backreferencing to make it a bit pickier, but it probably isn't necessary. Assume the usual caveats. --Ben [EMAIL PROTECTED] wrote: Hey folks, I have a regular expression I need for the following: I have filenames that have the following appended to them: filename_100x100.png filename_640x480.png filename_86x86.png and so on I need to extract JUST the filename. The kicker is, the filename MAY include underscores, so I can't just search for that. I know I could do several finds on the different resolutions, but I also know there's got to be a nifty way with a RegEx to do it. Anyone want to take a stab at it? Thanks, Dave ** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, ALLTEL requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217862 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: More RegExp help...
Ben, That's it. Makes pefect sense now. Thanks! Dave -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 5:17 PM To: CF-Talk Subject: Re: More RegExp help... rereplace(string, _[0-9]+x[0-9]+\.png, ); If the pixel size (I assume that's what the numbers are) is always a square, you might use backreferencing to make it a bit pickier, but it probably isn't necessary. Assume the usual caveats. --Ben [EMAIL PROTECTED] wrote: Hey folks, I have a regular expression I need for the following: I have filenames that have the following appended to them: filename_100x100.png filename_640x480.png filename_86x86.png and so on I need to extract JUST the filename. The kicker is, the filename MAY include underscores, so I can't just search for that. I know I could do several finds on the different resolutions, but I also know there's got to be a nifty way with a RegEx to do it. Anyone want to take a stab at it? Thanks, Dave ** The information contained in this message, including attachments, may contain privileged or confidential information that is intended to be delivered only to the person identified above. If you are not the intended recipient, or the person responsible for delivering this message to the intended recipient, ALLTEL requests that you immediately notify the sender and asks that you do not read the message or its attachments, and that you delete them without copying or sending them to anyone else. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217864 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: regexp help
:) well that regex didn't produce a match unfortunately.. however i was just looking at this thinking man this is screwey.. maybe the \r isnt required for some odd reason. so i revised the regex to read: ([[:alnum:]]+)\r?\s*([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) and got a match! but it was on: item1 0344437 1 03/12/2004 USD 335.75 so the next important thing is to add a space to the :alnum: list and bam! i got the full match. so with the regex revised to: ([[:alnum:] ]+)\r?\s*([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) i get the match i needed wich is: description of some item1 0344437 1 03/12/2004 USD 335.75 its still not quite perfect, but hey, its matching thats the important part!! Thanks for your help!! -chris heh after talk'n out of my but this should work for you ([[:alnum:] ]+)\r \s*([0-9]{7})\s*([0-9]+)\s*([0-3][0-9]/[0-1][0-9]/[0-9]{4})\s*([A-Z]{2, 3})\s*([0-9]+\.[0-9]{2}) You have to add some of your own business logic to not parse the this is just a confirmation email emails. I do not know all the codes that you are using with the USD codes so I left it like this: [A-Z]{2,3} I just hope that I have helped somewhere. Ian - Original Message - From: chris porter [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 21:40:53 -0400 Subject: Re: regexp help To: CF-Talk [EMAIL PROTECTED] that was an option i explored, however these emails arent coming from just one source, in fact there are hundreds of different company emails coming in, so my options were, either 1) define the data i need, and specify a regex to grab it, then database the expressions, or 2) write a custom script in code that can identify each one of those possibly by regex. personally i opted for option a cause i can always fine tune an _expression_, but changing code gets tedious. on another note, what distinguishes the item description line during a line by line scan from something like this is just a confirmation email. get my drift? -chris I understand that, what I meant was, wouldn't it be easier to parse each line separately? This way you do not need to have such a highly complicated RegEx. You can make it much more simple and a little bit more flexible. Not to mention easier to maintain. (i.e. two separate regular expressions or more) cfscript email = emailFromServer; // focused down to the body content only n = listlen(email,chr(13) chr(32)); output = arraynew(1); output[1] = structnew(); a = arraynew(2); a[1][1] = RegEx; a[1][2] = description; a[2][1] = RegEx; a[2][2] = productnumber; nn = arraylen(a); // regex count nnn = 1; // record count c = 0; // field count for (i=1:i LTE n;i=i+1) { currentitem = listgetat(email,i,chr(13) chr(32)); for (ii=1;ii LTE nn;ii=ii+1) { if (refind(a[i][1],currentitem)) { output[nnn]['#a[i][2]#'] = trim(currentitem); if (c GT 5) { c = 0; nnn = nnn + 1; output[nnn] = structnew(); } else { c = c +1; } } } } /cfscript heh I went a little crazy here but I pretty sure this would work. Any future changes on what each feild would hold would be easy to change. (beware I did not test it) Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 18:23:04 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] You can get the first and second lines based on a new line delimited list and you can get the items in the second line using a space delimited list. I just like to be specific when parsing data from a source like email. My preference is to pop 2 messages, save the first in a DB (raw) and use the second as a flag to rerun the page. Once all the mail is down and stored in the DB (one at a time, there's a reason), I have a second process parse each message in the tightest way possible. I'm paranoid (as all programmers should be) about data from outside sources and I want to be 100% sure of what I'm getting and how. If there's a problem, then I want to know exactly what's up. _ Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#ch r(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED
regexp help
hi guys, heres a quick regexp question for ya.. i have this text (from an email and need a regex that will match the product info protions: Here's the text: (might need to expand your window to see the full format) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: regexp help
Remember that the list removes all text that comes after a line of dashes. You may want to repost that text you want to parse. On the other hand, your in luck as I just finished another email parser to grab products out of an email for entry into a DB (for mothernature.com). I should be able to help. _ hi guys, heres a quick regexp question for ya.. i have this text (from an email and need a regex that will match the product info protions: Here's the text: (might need to expand your window to see the full format) _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
Hmm got bit by that lines problem... good advanced warning that that will happen ;) here is the text: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: regexp help
OK, lets do the pattern dance. The product name will always be on it's own line and followed by the product info? What is the number format (if any). What can it contain (spaces, dashes, etc.). Is the quantity always there? Ship date always there? in any specific format? Price always there? Always in price format? If there's a specific pattern to the data (which there should be), then you can have a fast and easy RegEx to parse it all in no time. _ Hmm got bit by that lines problem... good advanced warning that that will happen ;) here is the text: Product Name Product NumberQtyEst. Ship DateYour Ext. Price _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: regexp help
Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: regexp help
You can get the first and second lines based on a new line delimited list and you can get the items in the second line using a space delimited list. I just like to be specific when parsing data from a source like email. My preference is to pop 2 messages, save the first in a DB (raw) and use the second as a flag to rerun the page. Once all the mail is down and stored in the DB (one at a time, there's a reason), I have a second process parse each message in the tightest way possible. I'm paranoid (as all programmers should be) about data from outside sources and I want to be 100% sure of what I'm getting and how. If there's a problem, then I want to know exactly what's up. _ Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
I understand that, what I meant was, wouldn't it be easier to parse each line separately? This way you do not need to have such a highly complicated RegEx. You can make it much more simple and a little bit more flexible. Not to mention easier to maintain. (i.e. two separate regular expressions or more) cfscript email = emailFromServer; // focused down to the body content only n = listlen(email,chr(13) chr(32)); output = arraynew(1); output[1] = structnew(); a = arraynew(2); a[1][1] = RegEx; a[1][2] = description; a[2][1] = RegEx; a[2][2] = productnumber; nn = arraylen(a); // regex count nnn = 1; // record count c = 0; // field count for (i=1:i LTE n;i=i+1) { currentitem = listgetat(email,i,chr(13) chr(32)); for (ii=1;ii LTE nn;ii=ii+1) { if (refind(a[i][1],currentitem)) { output[nnn]['#a[i][2]#'] = trim(currentitem); if (c GT 5) { c = 0; nnn = nnn + 1; output[nnn] = structnew(); } else { c = c +1; } } } } /cfscript heh I went a little crazy here but I pretty sure this would work. Any future changes on what each feild would hold would be easy to change. (beware I did not test it) Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 18:23:04 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] You can get the first and second lines based on a new line delimited list and you can get the items in the second line using a space delimited list. I just like to be specific when parsing data from a source like email. My preference is to pop 2 messages, save the first in a DB (raw) and use the second as a flag to rerun the page. Once all the mail is down and stored in the DB (one at a time, there's a reason), I have a second process parse each message in the tightest way possible. I'm paranoid (as all programmers should be) about data from outside sources and I want to be 100% sure of what I'm getting and how. If there's a problem, then I want to know exactly what's up. _ Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
hmm that didnt provide a match in either the example i sent, or the actual data.. did you verrify it first? also how are you loading the regex? i was just using reFindNoCase() maybe there's a better way. I do like where you are going with the first part of your regex though. Its similar to what i origionally tried: ^([^\n\r]+)[\n\r]+([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) and ^([^\n\r]+)([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) i would think that the ^would anchor to the beginning of a line (like its supposed to), ([^\n\r]+) would find an entire line of text (since the _expression_ reads as many characters that are not newline or return) and [\n\r]+ match the CRLF at the end, then the rest of the working regex (its a mess so i wont paste that part in) would kick in. it then occured to me that it was possible that by using the [^\n\r] it possibly was providing a match on those characters, and therefore the next [\n\r]+ wouldnt find a match as the parser had already passed them during the previous find, so i removed the [\n\r]+ but still no love ( and in fact that theory is wrong, the parser stops at the invalid characters and tests those against the next part of the _expression_). so there is something not happening that i'm missing. also, i appreciate the changing of the working regex but a couple of things to note here (and also some wise info for newbies out there): 1) the USD is the country code of the currency, and is not optional and wont alwasy be USD, therefore hard refrencing with (USD)? doesn't really make the regex work in all cases in fact, if the country code were GBP the optional specifier would fail (since USD was not found), and the pattern would fail because there wouldnt be anything to handle the 3 unhandled characters that were actually there. 2) while the regex used for the date is great, the requirement isnt for date validation here, just field delimitation. this is mainly because we cannot controll the format the data is being received in and as such, we wont know if the date is 10-06-78 or Oct-06-78 etc etc. i'd need to change the regex again to accomodate that. a much simpler and accurate way to parse that section is to just look for the next space ([^ ]+) and let the sql date parser or createODBCdate() take care of it. anyways back to the topic at hand, what else am i missing at the beginning..? any thoughts anyone? Thanks -Chris Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
that was an option i explored, however these emails arent coming from just one source, in fact there are hundreds of different company emails coming in, so my options were, either 1) define the data i need, and specify a regex to grab it, then database the expressions, or 2) write a custom script in code that can identify each one of those possibly by regex. personally i opted for option a cause i can always fine tune an _expression_, but changing code gets tedious. on another note, what distinguishes the item description line during a line by line scan from something like this is just a confirmation email. get my drift? -chris I understand that, what I meant was, wouldn't it be easier to parse each line separately? This way you do not need to have such a highly complicated RegEx. You can make it much more simple and a little bit more flexible. Not to mention easier to maintain. (i.e. two separate regular expressions or more) cfscript email = emailFromServer; // focused down to the body content only n = listlen(email,chr(13) chr(32)); output = arraynew(1); output[1] = structnew(); a = arraynew(2); a[1][1] = RegEx; a[1][2] = description; a[2][1] = RegEx; a[2][2] = productnumber; nn = arraylen(a); // regex count nnn = 1; // record count c = 0; // field count for (i=1:i LTE n;i=i+1) { currentitem = listgetat(email,i,chr(13) chr(32)); for (ii=1;ii LTE nn;ii=ii+1) { if (refind(a[i][1],currentitem)) { output[nnn]['#a[i][2]#'] = trim(currentitem); if (c GT 5) { c = 0; nnn = nnn + 1; output[nnn] = structnew(); } else { c = c +1; } } } } /cfscript heh I went a little crazy here but I pretty sure this would work. Any future changes on what each feild would hold would be easy to change. (beware I did not test it) Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 18:23:04 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] You can get the first and second lines based on a new line delimited list and you can get the items in the second line using a space delimited list. I just like to be specific when parsing data from a source like email. My preference is to pop 2 messages, save the first in a DB (raw) and use the second as a flag to rerun the page. Once all the mail is down and stored in the DB (one at a time, there's a reason), I have a second process parse each message in the tightest way possible. I'm paranoid (as all programmers should be) about data from outside sources and I want to be 100% sure of what I'm getting and how. If there's a problem, then I want to know exactly what's up. _ Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: regexp help
heh after talk'n out of my but this should work for you ([[:alnum:] ]+)\r\s*([0-9]{7})\s*([0-9]+)\s*([0-3][0-9]/[0-1][0-9]/[0-9]{4})\s*([A-Z]{2,3})\s*([0-9]+\.[0-9]{2}) You have to add some of your own business logic to not parse the this is just a confirmation email emails. I do not know all the codes that you are using with the USD codes so I left it like this: [A-Z]{2,3} I just hope that I have helped somewhere. Ian - Original Message - From: chris porter [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 21:40:53 -0400 Subject: Re: regexp help To: CF-Talk [EMAIL PROTECTED] that was an option i explored, however these emails arent coming from just one source, in fact there are hundreds of different company emails coming in, so my options were, either 1) define the data i need, and specify a regex to grab it, then database the expressions, or 2) write a custom script in code that can identify each one of those possibly by regex. personally i opted for option a cause i can always fine tune an _expression_, but changing code gets tedious. on another note, what distinguishes the item description line during a line by line scan from something like this is just a confirmation email. get my drift? -chris I understand that, what I meant was, wouldn't it be easier to parse each line separately? This way you do not need to have such a highly complicated RegEx. You can make it much more simple and a little bit more flexible. Not to mention easier to maintain. (i.e. two separate regular expressions or more) cfscript email = emailFromServer; // focused down to the body content only n = listlen(email,chr(13) chr(32)); output = arraynew(1); output[1] = structnew(); a = arraynew(2); a[1][1] = RegEx; a[1][2] = description; a[2][1] = RegEx; a[2][2] = productnumber; nn = arraylen(a); // regex count nnn = 1; // record count c = 0; // field count for (i=1:i LTE n;i=i+1) { currentitem = listgetat(email,i,chr(13) chr(32)); for (ii=1;ii LTE nn;ii=ii+1) { if (refind(a[i][1],currentitem)) { output[nnn]['#a[i][2]#'] = trim(currentitem); if (c GT 5) { c = 0; nnn = nnn + 1; output[nnn] = structnew(); } else { c = c +1; } } } } /cfscript heh I went a little crazy here but I pretty sure this would work. Any future changes on what each feild would hold would be easy to change. (beware I did not test it) Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 18:23:04 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] You can get the first and second lines based on a new line delimited list and you can get the items in the second line using a space delimited list. I just like to be specific when parsing data from a source like email. My preference is to pop 2 messages, save the first in a DB (raw) and use the second as a flag to rerun the page. Once all the mail is down and stored in the DB (one at a time, there's a reason), I have a second process parse each message in the tightest way possible. I'm paranoid (as all programmers should be) about data from outside sources and I want to be 100% sure of what I'm getting and how. If there's a problem, then I want to know exactly what's up. _ Why don;t you just go through the text as a list with CR as the delimiter? This way you can have much more focused regular expressions. Just a thought, Ian - Original Message - From: Michael Dinowitz [EMAIL PROTECTED] Date: Mon, 30 Aug 2004 16:49:48 -0400 Subject: RE: regexp help To: CF-Talk [EMAIL PROTECTED] Really fast (Using the multi-line move of CFMX) ^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2 }/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$ _ From: chris porter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 4:41 PM To: CF-Talk Subject: Re: regexp help and one last time DATA: Product Name Product NumberQtyEst. Ship DateYour Ext. Price [dashed go here all the way across PITA email parser] description of some item1 0344437103/12/2004USD 335.75 another description of some item1 0344734103/12/2004USD 335.75 and one last description of some item 0433447103/12/2004USD 335.75 part i need parsed by a regex description of some item1 0344437103/12/2004USD 335.75 current REGEX: ([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+) that regex matches everything on the 2nd line correctly, but nothing i add to the beginning will match the first line. any thoughts? Thanks! -Chris [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
A little regexp help
This is probably a simple one, but I have little experience with regexps.I have a string that must only contain letters and/or numbers and be between 6 and 20 characters long.So far, I have [a-zA-Z0-9]{6,20} but that only gets me 1/2 way there. Thanks! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
^[a-zA-Z0-9]{6,20}$ The ^ matches the beginning o the string and the $ the end. --Ben Doom Todd wrote: This is probably a simple one, but I have little experience with regexps.I have a string that must only contain letters and/or numbers and be between 6 and 20 characters long.So far, I have [a-zA-Z0-9]{6,20} but that only gets me 1/2 way there. Thanks! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Thanks, but doesn't quite do it.I should probably clarify what I need.I left out an important word last time. What I need to end up with is a string that is anywhere between 6 and 20 characters long that contains _only_ letters and/or numbers.No special characters at all.In the case of ^[a-zA-Z0-9]{6,20}$ it allows special characters once it finds at least 6 letters and/or numbers.It's that only part that is giving me trouble. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 3:55 PM Subject: Re: A little regexp help ^[a-zA-Z0-9]{6,20}$ The ^ matches the beginning o the string and the $ the end. --Ben Doom [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
characters long that contains _only_ letters and/or numbers.No special characters at all.In the case of ^[a-zA-Z0-9]{6,20}$ it allows special characters once it finds at least 6 letters and/or numbers.It's that only part that is giving me trouble. Um.No, it shouldn't.I doesn't allow anything between the last character matched by the class and the end of the string. Are you actually seeing this behavior? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Are you trying to FIND a valid string, an invalid string, or are you trying to FIX an invalid string? Jerry Johnson [EMAIL PROTECTED] 06/25/04 04:04PM Thanks, but doesn't quite do it.I should probably clarify what I need.I left out an important word last time. What I need to end up with is a string that is anywhere between 6 and 20 characters long that contains _only_ letters and/or numbers.No special characters at all.In the case of ^[a-zA-Z0-9]{6,20}$ it allows special characters once it finds at least 6 letters and/or numbers.It's that only part that is giving me trouble. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Yes. It works correctly as long as there are not at least 6 alphanumeric characters side by side.Once there are 6 in a row, it accepts everything, even when there are more than 20 characters entered.I'm trying to validate a password, btw. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 4:09 PM Subject: Re: A little regexp help characters long that contains _only_ letters and/or numbers.No special characters at all.In the case of ^[a-zA-Z0-9]{6,20}$ it allows special characters once it finds at least 6 letters and/or numbers.It's that only part that is giving me trouble. Um.No, it shouldn't.I doesn't allow anything between the last character matched by the class and the end of the string. Are you actually seeing this behavior? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
When someone adds or resets a password, I'm trying to make sure what they entered matches the pattern I described below. - Original Message - From: Jerry Johnson [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 4:14 PM Subject: Re: A little regexp help Are you trying to FIND a valid string, an invalid string, or are you trying to FIX an invalid string? Jerry Johnson [EMAIL PROTECTED] 06/25/04 04:04PM Thanks, but doesn't quite do it.I should probably clarify what I need. I left out an important word last time. What I need to end up with is a string that is anywhere between 6 and 20 characters long that contains _only_ letters and/or numbers.No special characters at all.In the case of ^[a-zA-Z0-9]{6,20}$ it allows special characters once it finds at least 6 letters and/or numbers.It's that only part that is giving me trouble. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
When I tested ^[a-zA-Z0-9]{6,20}$ against astrjuh it matched, but not when I tested it against astrjuh$. What version of CF are you using? --Ben Todd wrote: Yes. It works correctly as long as there are not at least 6 alphanumeric characters side by side.Once there are 6 in a row, it accepts everything, even when there are more than 20 characters entered.I'm trying to validate a password, btw. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
6.1 Enterprise I'm beginning to think it's some screwy thing with the pattern attribute.I should probably just break it out into a seperate _javascript_ function and be done with it. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:08 PM Subject: Re: A little regexp help When I tested ^[a-zA-Z0-9]{6,20}$ against astrjuh it matched, but not when I tested it against astrjuh$. What version of CF are you using? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Yes.The pattern attribute of cfinput does in fact seem to be the culprit. I tell it ^[a-zA-Z0-9]{6,20}$ and it generates this: if(!_CF_checkregex(_CF_this.password.value, /\w{6,}/)) - Original Message - From: Todd [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:20 PM Subject: Re: A little regexp help 6.1 Enterprise I'm beginning to think it's some screwy thing with the pattern attribute. I should probably just break it out into a seperate _javascript_ function and be done with it. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:08 PM Subject: Re: A little regexp help When I tested ^[a-zA-Z0-9]{6,20}$ against astrjuh it matched, but not when I tested it against astrjuh$. What version of CF are you using? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Is this _javascript_ Regex, or CF regex? (It makes a BIG difference) Jerry Johnson [EMAIL PROTECTED] 06/25/04 05:20PM 6.1 Enterprise I'm beginning to think it's some screwy thing with the pattern attribute.I should probably just break it out into a seperate _javascript_ function and be done with it. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:08 PM Subject: Re: A little regexp help When I tested ^[a-zA-Z0-9]{6,20}$ against astrjuh it matched, but not when I tested it against astrjuh$. What version of CF are you using? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: A little regexp help
Yeah Using the pattern in _javascript_ (which is how cfinput checks) is different from CF.You can write the same thing as a JS regex (I'd have to play around to get it right, but it should be awful similar) but I was writing a CF regex. All we had here was a failure to communicate :-) --Ben Todd wrote: Yes.The pattern attribute of cfinput does in fact seem to be the culprit. I tell it ^[a-zA-Z0-9]{6,20}$ and it generates this: if(!_CF_checkregex(_CF_this.password.value, /\w{6,}/)) - Original Message - From: Todd [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:20 PM Subject: Re: A little regexp help 6.1 Enterprise I'm beginning to think it's some screwy thing with the pattern attribute. I should probably just break it out into a seperate _javascript_ function and be done with it. - Original Message - From: Ben Doom [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, June 25, 2004 5:08 PM Subject: Re: A little regexp help When I tested ^[a-zA-Z0-9]{6,20}$ against astrjuh it matched, but not when I tested it against astrjuh$. What version of CF are you using? --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
[OT] - RegExp Help
Hi all, I'm trying to write a regular _expression_ and am having a little trouble... What I want to do is replace all instances of '/document.cfm' in a string with '/public/document.cfm', unless the original substring is '/public/document.cfm' - ie I don't want to end up with '/public/public/document.cfm'. This is what I;ve been trying: #ReReplace('.open.ac.uk/document.cfmtest','(^public)/document.cfm','/pu blic/document.cfm')# But in this instance it's not finding a match, so not replacing the required substring - can anyone give me any pointers as to where I;ve gone wrong? I found plenty of examples about Reg Exp generally, but none which seem to fit what I'm trying to achieve. Thanks, Alex [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: [OT] - RegExp Help
I'm trying to write a regular _expression_ and am having a little trouble... What I want to do is replace all instances of '/document.cfm' in a string with '/public/document.cfm', unless the original substring is '/public/document.cfm' - ie I don't want to end up with '/public/public/document.cfm'. As far as I remember, CF MX RegExp don't support lookbehind, so I would try this, accessing directely Java's string methods: cfset str1 = open.ac.uk/document.cfmtest cfset str2 = directory/public/document.cfm cfset pattern = (?!public)/document.cfm cfoutput#str1.replaceFirst(pattern,'/public/document.cfm')#/cfoutput br cfoutput#str2.replaceFirst(pattern,'/public/document.cfm')#/cfoutput Be adviced it requires CF 6.1 (or JRE 1.4+). I am sure there are other alternatives, so you may want to investigate them as well. Hope it will help Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: [OT] - RegExp Help
BTW Since sometimes I fund useful to access Jav's string APIs, I put together a collection of UDF inside a CFC: http://www.cfmentor.com/code/index.cfm?action=""> I am also almost finished a similar CFC that act as a wrapper for the java.util.regex package. I just need to polish it a little bit; it will available very soon. Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: [OT] - RegExp Help
Wow.That's pretty cool.I would love to see a copy when it gets finished. --Ben doom Massimo Foti wrote: BTW Since sometimes I fund useful to access Jav's string APIs, I put together a collection of UDF inside a CFC: http://www.cfmentor.com/code/index.cfm?action=""> http://www.cfmentor.com/code/index.cfm?action=""> I am also almost finished a similar CFC that act as a wrapper for the java.util.regex package. I just need to polish it a little bit; it will available very soon. Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: [OT] - RegExp Help
Besides using regex, there's a pretty stilly way of dealing with this. Replace() all the /public/document.cfm links with just /document.cfm, then replace all the /document.cfm links with /public/document.cfm It's a bit absurd, but it's an easy, quick fix that doesn't have to invoke a regex engine. --Ben Doom A.Little wrote: Hi all, I'm trying to write a regular _expression_ and am having a little trouble... What I want to do is replace all instances of '/document.cfm' in a string with '/public/document.cfm', unless the original substring is '/public/document.cfm' - ie I don't want to end up with '/public/public/document.cfm'. This is what I;ve been trying: #ReReplace('.open.ac.uk/document.cfmtest','(^public)/document.cfm','/pu blic/document.cfm')# But in this instance it's not finding a match, so not replacing the required substring - can anyone give me any pointers as to where I;ve gone wrong? I found plenty of examples about Reg Exp generally, but none which seem to fit what I'm trying to achieve. Thanks, Alex [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: RegExp Help
Hi Jerry, was out the office yesterday [coder sees the light of day shock] and just wanted to say cheers for the help after my last post Good pointers in what I am needing to do in your code samples thanks :-) ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RegExp Help
Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... TaInAdvance ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
ud_stripout.*/ud_stripout I think, if not, nevermind... Neil Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: RegExp Help
What version of CF? How long can the string be you are stripping it from? By strip out, do you want the string returned without these tags in it? (As if you replaced them with ) Are the these tags ever nested? Jerry Johnson [EMAIL PROTECTED] 03/26/03 10:03AM Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... TaInAdvance ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
CF5 could be any length but for now won't be any longer than about 4000 characters. The tags will not be nested and i would just like the RegExp to remove the code between these tags and the tags themselves (As if you replaced them with , YES :-) i appreciate any help as I am absolutely hopeless with RegExp and I know there are experts on the list -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 15:03 To: CF-Talk Subject: Re: RegExp Help What version of CF? How long can the string be you are stripping it from? By strip out, do you want the string returned without these tags in it? (As if you replaced them with ) Are the these tags ever nested? Jerry Johnson [EMAIL PROTECTED] 03/26/03 10:03AM Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... TaInAdvance ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
Hi Neil, Thanks for getting back to me... Your RegExp has done the trick well under it and really need to brush up on my RegExp skills but am always put off by the horrible ones you see getting used! Much appreciated anyway :-) -Original Message- From: Neil Middleton [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 15:01 To: CF-Talk Subject: RE: RegExp Help ud_stripout.*/ud_stripout I think, if not, nevermind... Neil Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
Can the ud_stripout tags contain other tags? Will there ever be more than one set in the page? Will the tags ever take any parameters ie ud_stripout class=dead? -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: Jerry Johnson [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 10:03 AM : To: CF-Talk : Subject: Re: RegExp Help : : : What version of CF? : How long can the string be you are stripping it from? : By strip out, do you want the string returned without these tags : in it? (As if you replaced them with ) : Are the these tags ever nested? : : Jerry Johnson : : : [EMAIL PROTECTED] 03/26/03 10:03AM : Can anyone help me with the RegExp for stripping out content between two : defined tags... ie : : ud_stripout : ... : Content to strip out : ... : /ud_stripout : : I would need it to strip out all the content and the tags themselves as : well... : : TaInAdvance : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
thats alright, thats about the only regexp I know..;-) Neil Hi Neil, Thanks for getting back to me... Your RegExp has done the trick well under it and really need to brush up on my RegExp skills but am always put off by the horrible ones you see getting used! Much appreciated anyway :-) ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
Just be aware that if you have a page like Between ud_stripoutthe waves/ud_stripout and the shore ud_stripout there's a boat/ud_stripout here. You'll get Between here. not Between and the shore here. Because that regex will strip /everything/ between the /first/ open and the /last/ close. Which is why some of us are asking wierd questions about it. :-) -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 10:25 AM : To: CF-Talk : Subject: RE: RegExp Help : : : Hi Neil, Thanks for getting back to me... : : Your RegExp has done the trick well under it and really need to : brush up on my RegExp skills but am always put off by the horrible ones : you see getting used! : : Much appreciated anyway :-) : : : : -Original Message- : From: Neil Middleton [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:01 : To: CF-Talk : Subject: RE: RegExp Help : : : ud_stripout.*/ud_stripout : : I think, if not, nevermind... : : Neil : : : Can anyone help me with the RegExp for stripping out content : between two : defined tags... ie : : ud_stripout : ... : Content to strip out : ... : /ud_stripout : : I would need it to strip out all the content and the tags : themselves as : well... : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
FYI: The purpose was to rip out the HTML buttons of a report when converting to PDF Neil's RegExp did what I needed as I could guarantee that there would only be one set on the page that surrounded the HTML code for the buttons. (Calling the report via CFHTTP so got it all in a variable to run the RegExp on) Ben Jerry's questions do make me quite inquisitive as I am a bit fearful of RegExp but I do realise that they could help me code so much better... unfortunately... just dont have the time to learn it at the moment as the Man has me working like crazy... Anyway Cheers for your help everyone PS anyone got any good resouces for learning RegExp? -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 15:21 To: CF-Talk Subject: RE: RegExp Help Can the ud_stripout tags contain other tags? Will there ever be more than one set in the page? Will the tags ever take any parameters ie ud_stripout class=dead? -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: Jerry Johnson [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 10:03 AM : To: CF-Talk : Subject: Re: RegExp Help : : : What version of CF? : How long can the string be you are stripping it from? : By strip out, do you want the string returned without these tags : in it? (As if you replaced them with ) : Are the these tags ever nested? : : Jerry Johnson : : : [EMAIL PROTECTED] 03/26/03 10:03AM : Can anyone help me with the RegExp for stripping out content between two : defined tags... ie : : ud_stripout : ... : Content to strip out : ... : /ud_stripout : : I would need it to strip out all the content and the tags themselves as : well... : : TaInAdvance : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
You can't give up now just because its working! Ben and I are chomping at the bit. Can there be more than one of these sets of tags in the string? (Neil's solution assumes 1 and only 1 set in the string) Jerry Johnson [EMAIL PROTECTED] 03/26/03 10:24AM Hi Neil, Thanks for getting back to me... Your RegExp has done the trick well under it and really need to brush up on my RegExp skills but am always put off by the horrible ones you see getting used! Much appreciated anyway :-) -Original Message- From: Neil Middleton [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 15:01 To: CF-Talk Subject: RE: RegExp Help ud_stripout.*/ud_stripout I think, if not, nevermind... Neil Can anyone help me with the RegExp for stripping out content between two defined tags... ie ud_stripout ... Content to strip out ... /ud_stripout I would need it to strip out all the content and the tags themselves as well... ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
If you like books, I'd reccommend starting with the regex chapter of Advanced Macromedia ColdFusion 5 Application Development by Ben Forta However, that seems to assume that you already know a bit about regex and just need to know about porting to CF5 POSIX-like syntax and the limitations of the CF5 engine. If you want to know more about regex in general, and especially Javascript and Perlish (and therefore CFMXish) regex, I'd reccommend Mastering Regular Expressions from O'Reilly. If you want something quick, easy, and interactive, I'd reccommend http://www.houseoffusion.com/cf_lists/index.cfm?method=threadsforumid=21 for all your CF regex needs. The ninjas are standing by. -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 10:34 AM : To: CF-Talk : Subject: RE: RegExp Help : : : FYI: The purpose was to rip out the HTML buttons of a report when : converting to PDF : : Neil's RegExp did what I needed as I could guarantee that there would : only be one set on the page that surrounded the HTML code for the : buttons. (Calling the report via CFHTTP so got it all in a variable to : run the RegExp on) : : Ben Jerry's questions do make me quite inquisitive as I am a bit : fearful of RegExp but I do realise that they could help me code so : much better... : : unfortunately... just dont have the time to learn it at the moment as : the Man has me working like crazy... : : Anyway Cheers for your help everyone : : PS anyone got any good resouces for learning RegExp? : : -Original Message- : From: Ben Doom [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:21 : To: CF-Talk : Subject: RE: RegExp Help : : : Can the ud_stripout tags contain other tags? : Will there ever be more than one set in the page? : Will the tags ever take any parameters ie ud_stripout class=dead? : : : -- Ben Doom : Programmer General Lackey : Moonbow Software, Inc : : : -Original Message- : : From: Jerry Johnson [mailto:[EMAIL PROTECTED] : : Sent: Wednesday, March 26, 2003 10:03 AM : : To: CF-Talk : : Subject: Re: RegExp Help : : : : : : What version of CF? : : How long can the string be you are stripping it from? : : By strip out, do you want the string returned without these tags : : in it? (As if you replaced them with ) : : Are the these tags ever nested? : : : : Jerry Johnson : : : : : : [EMAIL PROTECTED] 03/26/03 10:03AM : : Can anyone help me with the RegExp for stripping out content between : two : : defined tags... ie : : : : ud_stripout : : ... : : Content to strip out : : ... : : /ud_stripout : : : : I would need it to strip out all the content and the tags themselves : as : : well... : : : : TaInAdvance : : : : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
Hi all... All right guys I actually do want to take it a bit further if you don't mind... at the moment I only have one set of tags per page... but I was starting to think I could use this all over the place and it would be very handy... How would you go about ensuring that it only stripped out between the opening and closing tag (if there were multiple) and not the others as and not get the mucked up answer as listed below by Ben Cheers PS Subscription to CF_RegExp has left my inbox. And yes, they did seem like weird questions but I understand why now :-) -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 15:29 To: CF-Talk Subject: RE: RegExp Help Just be aware that if you have a page like Between ud_stripoutthe waves/ud_stripout and the shore ud_stripout there's a boat/ud_stripout here. You'll get Between here. not Between and the shore here. Because that regex will strip /everything/ between the /first/ open and the /last/ close. Which is why some of us are asking wierd questions about it. :-) -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 10:25 AM : To: CF-Talk : Subject: RE: RegExp Help : : : Hi Neil, Thanks for getting back to me... : : Your RegExp has done the trick well under it and really need to : brush up on my RegExp skills but am always put off by the horrible ones : you see getting used! : : Much appreciated anyway :-) : : : : -Original Message- : From: Neil Middleton [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:01 : To: CF-Talk : Subject: RE: RegExp Help : : : ud_stripout.*/ud_stripout : : I think, if not, nevermind... : : Neil : : : Can anyone help me with the RegExp for stripping out content : between two : defined tags... ie : : ud_stripout : ... : Content to strip out : ... : /ud_stripout : : I would need it to strip out all the content and the tags : themselves as : well... : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
The easy answer (for me) is to upgrade to CFMX, which allows non-greedy matches, which are intended to do exactly that. If you really need to do this, I'd use refind() to locate each instance of the beginning and ending tags and loop over that, removing them as I find them. HTH -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 11:17 AM : To: CF-Talk : Subject: RE: RegExp Help : : : Hi all... : : All right guys I actually do want to take it a bit further if you don't : mind... at the moment I only have one set of tags per page... but I was : starting to think I could use this all over the place and it would be : very handy... : : How would you go about ensuring that it only stripped out between the : opening and closing tag (if there were multiple) and not the others as : and not get the mucked up answer as listed below by Ben : : Cheers : : PS Subscription to CF_RegExp has left my inbox. And yes, they did seem : like weird questions but I understand why now :-) : : -Original Message- : From: Ben Doom [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:29 : To: CF-Talk : Subject: RE: RegExp Help : : : Just be aware that if you have a page like : : Between ud_stripoutthe waves/ud_stripout and the shore ud_stripout : there's a boat/ud_stripout here. : : You'll get : Between here. : not : Between and the shore here. : : Because that regex will strip /everything/ between the /first/ open and : the /last/ close. Which is why some of us are asking wierd questions : about it. : :-) : : : -- Ben Doom : Programmer General Lackey : Moonbow Software, Inc : : : -Original Message- : : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : : Sent: Wednesday, March 26, 2003 10:25 AM : : To: CF-Talk : : Subject: RE: RegExp Help : : : : : : Hi Neil, Thanks for getting back to me... : : : : Your RegExp has done the trick well under it and really need to : : brush up on my RegExp skills but am always put off by the horrible : ones : : you see getting used! : : : : Much appreciated anyway :-) : : : : : : : : -Original Message- : : From: Neil Middleton [mailto:[EMAIL PROTECTED] : : Sent: 26 March 2003 15:01 : : To: CF-Talk : : Subject: RE: RegExp Help : : : : : : ud_stripout.*/ud_stripout : : : : I think, if not, nevermind... : : : : Neil : : : : : : Can anyone help me with the RegExp for stripping out content : : between two : : defined tags... ie : : : : ud_stripout : :... : :Content to strip out : :... : : /ud_stripout : : : : I would need it to strip out all the content and the tags : : themselves as : : well... : : : : : : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
No CFMX upgrade for a while unfortunately, will look into the refind (if I get time!) Cheers to Neil, Jerry and Ben, much appreciated -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 16:30 To: CF-Talk Subject: RE: RegExp Help The easy answer (for me) is to upgrade to CFMX, which allows non-greedy matches, which are intended to do exactly that. If you really need to do this, I'd use refind() to locate each instance of the beginning and ending tags and loop over that, removing them as I find them. HTH -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 11:17 AM : To: CF-Talk : Subject: RE: RegExp Help : : : Hi all... : : All right guys I actually do want to take it a bit further if you don't : mind... at the moment I only have one set of tags per page... but I was : starting to think I could use this all over the place and it would be : very handy... : : How would you go about ensuring that it only stripped out between the : opening and closing tag (if there were multiple) and not the others as : and not get the mucked up answer as listed below by Ben : : Cheers : : PS Subscription to CF_RegExp has left my inbox. And yes, they did seem : like weird questions but I understand why now :-) : : -Original Message- : From: Ben Doom [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:29 : To: CF-Talk : Subject: RE: RegExp Help : : : Just be aware that if you have a page like : : Between ud_stripoutthe waves/ud_stripout and the shore ud_stripout : there's a boat/ud_stripout here. : : You'll get : Between here. : not : Between and the shore here. : : Because that regex will strip /everything/ between the /first/ open and : the /last/ close. Which is why some of us are asking wierd questions : about it. : :-) : : : -- Ben Doom : Programmer General Lackey : Moonbow Software, Inc : : : -Original Message- : : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : : Sent: Wednesday, March 26, 2003 10:25 AM : : To: CF-Talk : : Subject: RE: RegExp Help : : : : : : Hi Neil, Thanks for getting back to me... : : : : Your RegExp has done the trick well under it and really need to : : brush up on my RegExp skills but am always put off by the horrible : ones : : you see getting used! : : : : Much appreciated anyway :-) : : : : : : : : -Original Message- : : From: Neil Middleton [mailto:[EMAIL PROTECTED] : : Sent: 26 March 2003 15:01 : : To: CF-Talk : : Subject: RE: RegExp Help : : : : : : ud_stripout.*/ud_stripout : : : : I think, if not, nevermind... : : : : Neil : : : : : : Can anyone help me with the RegExp for stripping out content : : between two : : defined tags... ie : : : : ud_stripout : :... : :Content to strip out : :... : : /ud_stripout : : : : I would need it to strip out all the content and the tags : : themselves as : : well... : : : : : : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegExp Help
It is nothing. This is not good code. I haven't really looked through it lately. Don't learn programming practice from it. With that said, I think this shows how to use find to remove tags and (optionally) content cfparam name=keepTagContent default=0 cfparam name=tag default=FONT cfparam name=tstr default=An example FONT face='fgfg'This should be gone/FONT This should still be there. cfset findstr=tag cfset endstr=/tag cfset tstr2=tstr cfset tnext=FindNoCase(findstr,tstr) cfif tnext NEQ 0 cfset tnewstr= cfset tstart=0 cfset tcRow=1 cfloop condition=tstart LTE len(tstr) cfset tnext=FindNoCase(findstr,tstr,tstart+1) cfif tnext NEQ 0 cfset tstart=tnext cfset tend=tstart cfset tagend=find(,tstr,tnext+1) cfset tagstr=trim(mid(tstr,tnext,tagend-(tnext-1))) cfset tnexttag=FindNoCase(endstr, tstr ,tend+1) cfif tnexttag NEQ 0 cfset tend=tnexttag cfset tfoundstr=mid(tstr,tstart,tend-(tstart-1)+(len(endstr)-1)) cfset tcRow=tcRow+1 cfif keepTagContent eq 0 cfset tstr2=replace(tstr2,tfoundstr,'') cfelse cfset tstr2=replace(tstr2,tfoundstr,'#mid(tfoundstr,len(tagstr)+1,(len(tfoundstr)-len(tagstr))-len(endstr))#') /cfif /cfif cfelse !--- aint no more footnotes, so we are done --- cfbreak /cfif /cfloop /cfif cfset result=tstr2 cfoutput#tstr#br #result#br/cfoutput [EMAIL PROTECTED] 03/26/03 12:04PM No CFMX upgrade for a while unfortunately, will look into the refind (if I get time!) Cheers to Neil, Jerry and Ben, much appreciated -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: 26 March 2003 16:30 To: CF-Talk Subject: RE: RegExp Help The easy answer (for me) is to upgrade to CFMX, which allows non-greedy matches, which are intended to do exactly that. If you really need to do this, I'd use refind() to locate each instance of the beginning and ending tags and loop over that, removing them as I find them. HTH -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : Sent: Wednesday, March 26, 2003 11:17 AM : To: CF-Talk : Subject: RE: RegExp Help : : : Hi all... : : All right guys I actually do want to take it a bit further if you don't : mind... at the moment I only have one set of tags per page... but I was : starting to think I could use this all over the place and it would be : very handy... : : How would you go about ensuring that it only stripped out between the : opening and closing tag (if there were multiple) and not the others as : and not get the mucked up answer as listed below by Ben : : Cheers : : PS Subscription to CF_RegExp has left my inbox. And yes, they did seem : like weird questions but I understand why now :-) : : -Original Message- : From: Ben Doom [mailto:[EMAIL PROTECTED] : Sent: 26 March 2003 15:29 : To: CF-Talk : Subject: RE: RegExp Help : : : Just be aware that if you have a page like : : Between ud_stripoutthe waves/ud_stripout and the shore ud_stripout : there's a boat/ud_stripout here. : : You'll get : Between here. : not : Between and the shore here. : : Because that regex will strip /everything/ between the /first/ open and : the /last/ close. Which is why some of us are asking wierd questions : about it. : :-) : : : -- Ben Doom : Programmer General Lackey : Moonbow Software, Inc : : : -Original Message- : : From: David Collie (itndac) [mailto:[EMAIL PROTECTED] : : Sent: Wednesday, March 26, 2003 10:25 AM : : To: CF-Talk : : Subject: RE: RegExp Help : : : : : : Hi Neil, Thanks for getting back to me... : : : : Your RegExp has done the trick well under it and really need to : : brush up on my RegExp skills but am always put off by the horrible : ones : : you see getting used! : : : : Much appreciated anyway
RE: RegExp Help
And this is a simple replace and regex combo. (This replace the end tag with a (hopefully) unused character, which should be much easier to find than the endtag string) cfparam name=tag default=FONT cfparam name=tstr default=An example FONT face='fgfg'This should be gone/FONT This should still be there.FONT This is more text to remove/FONT cfset tstr2=tstr cfset tstr2=replace(tstr2,/tag,ø,ALL) cfset tstr2=reReplaceNoCase(tstr2,tag[^ø]*ø,,ALL) cfoutput #tstr#br #tstr2#br /cfoutput Jerry ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: RegExp Help
- Original Message - From: Matthew Walker [EMAIL PROTECTED] cfset content=REReplaceNoCase(content, a href=([^ ]*) ([^]*), a href=\1%20\2, all) This will only replace one space per anchor. You need to run it repeatedly to get them all. - I ended up with a similar solution in replying to the original poster - with a conditional loop wrapped around it running REFind with the same regexp. Just curious: do you know why you have to loop around, even with the ALL scope set in REReplace? What's the point of the ALL bit? - Gyrus - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.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
Re: RegExp Help
BTW After I posted this I realised you had in fact already replied - d'oh! The problem is that the regex engine works thru the content character by character. It seems like if it finds a match from character x to character y, it will move on to x + 1. Is this right? - Original Message - From: Gyrus [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, May 25, 2002 2:40 AM Subject: Re: RegExp Help - Original Message - From: Matthew Walker [EMAIL PROTECTED] cfset content=REReplaceNoCase(content, a href=([^ ]*) ([^]*), a href=\1%20\2, all) This will only replace one space per anchor. You need to run it repeatedly to get them all. - I ended up with a similar solution in replying to the original poster - with a conditional loop wrapped around it running REFind with the same regexp. Just curious: do you know why you have to loop around, even with the ALL scope set in REReplace? What's the point of the ALL bit? - Gyrus - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available __ Get the mailserver that powers this list at http://www.coolfusion.com 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
RegExp Help
Hey all. I'm trying to cook up a regexp to search a block of text for links. What I'm looking for is something like: a href=path with spaces/file with spaces.htm I want to read the block of text and replace spaces with %20 so links won't break. I know, I know, links shouldn't have spaces in them, but this is something I inherited and changing all the links and filenames associated with them is not an option (there are thousands of links/files). I've tried this: cfset content=REReplaceNoCase(content, 'a href=(.*)', 'a href=#URLEncodedFormat(\1)#', all) and this: cfset content=REReplaceNoCase(content, 'a href=(.*)', 'a href=#Replace(\1, , %20))#', all) and those don't work. Can I not use CFML functions on a regexp subexpression (\1) ? I'm not exactly an expert on regexps, so any help would be greatly appreciated. Mike Wallick Web Application Developer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 651.628.5377 http://www.securecomputing.com http://www.securecomputing.com/ __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
Re: RegExp Help
- Original Message - From: Wallick, Mike [EMAIL PROTECTED] Hey all. I'm trying to cook up a regexp to search a block of text for links. What I'm looking for is something like: a href=path with spaces/file with spaces.htm I want to read the block of text and replace spaces with %20 so links won't break. --- Try this: cfloop condition=REFindNoCase('(a href=[^ ]+) ([^]*)', content) cfset content=REReplaceNoCase(content, '(a href=[^ ]+) ([^]*)', '\1%20\2', 'ALL') /cfloop I don't know why you have to loop around until they're all replaced - I thought setting the scope of REReplaceNoCase to 'ALL' would do that. Well, this is where *my* knowledge of regexps falls over! Maybe someone else can clear this up? Anyway, the regexp itself seems to work. A plain English translation: Match a href=, followed by one or more characters that aren't spaces, followed by a space, followed by zero or more characters that aren't quote marks, followed by a quote mark. Didn't think it was worth matching to the end of the a tag, this should be far enough. I'm sure the back references are clear enough. HTH, - Gyrus - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
RE: RegExp Help
Nobody seems to have replied, so here goes You don't want to use (.*) as regexes are greedy and will try to match the biggest string possible. If you have to as in a block, this regex will match from the start of one to the end of the other. cfset content=REReplaceNoCase(content, a href=([^ ]*) ([^]*), a href=\1%20\2, all) This will only replace one space per anchor. You need to run it repeatedly to get them all. Regards, Matthew Walker /* Easier, smarter forms: http://www.matthewwalker.net.nz/inform2 */ -Original Message- From: Wallick, Mike [mailto:[EMAIL PROTECTED]] Sent: Friday, 24 May 2002 3:24 a.m. To: CF-Talk Subject: RegExp Help Hey all. I'm trying to cook up a regexp to search a block of text for links. What I'm looking for is something like: a href=path with spaces/file with spaces.htm I want to read the block of text and replace spaces with %20 so links won't break. I know, I know, links shouldn't have spaces in them, but this is something I inherited and changing all the links and filenames associated with them is not an option (there are thousands of links/files). I've tried this: cfset content=REReplaceNoCase(content, 'a href=(.*)', 'a href=#URLEncodedFormat(\1)#', all) and this: cfset content=REReplaceNoCase(content, 'a href=(.*)', 'a href=#Replace(\1, , %20))#', all) and those don't work. Can I not use CFML functions on a regexp subexpression (\1) ? I'm not exactly an expert on regexps, so any help would be greatly appreciated. Mike Wallick Web Application Developer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 651.628.5377 http://www.securecomputing.com http://www.securecomputing.com/ __ Get the mailserver that powers this list at http://www.coolfusion.com 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
RegExp Help
Anyone Have a RegExp to get all content between the BODY tags? I found a UDF that parses out the title, but I'm trying to modify it to parse out the body instead, but I'm not having much luck. Any help would be greatly appreciated. mike wallick * web application developer * [EMAIL PROTECTED] * 651.628.5377 * http://www.securecomputing.com __ Get the mailserver that powers this list at http://www.coolfusion.com 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
Re: RegExp Help
cfset BodyContent=reReplaceNoCase(fileContent,.*BODY[^]*(.*)/BODY.*,\1) (or something like that) Jerry Johnson [EMAIL PROTECTED] 03/20/02 01:10PM Anyone Have a RegExp to get all content between the BODY tags? I found a UDF that parses out the title, but I'm trying to modify it to parse out the body instead, but I'm not having much luck. Any help would be greatly appreciated. mike wallick * web application developer * [EMAIL PROTECTED] * 651.628.5377 * http://www.securecomputing.com __ 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
RE: RegExp Help
You rock! That does exactly what I need it to do. Thanks Jerry Mike -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 1:13 PM To: CF-Talk Subject: Re: RegExp Help cfset BodyContent=reReplaceNoCase(fileContent,.*BODY[^]*(.*)/BODY.*,\1) (or something like that) Jerry Johnson [EMAIL PROTECTED] 03/20/02 01:10PM Anyone Have a RegExp to get all content between the BODY tags? I found a UDF that parses out the title, but I'm trying to modify it to parse out the body instead, but I'm not having much luck. Any help would be greatly appreciated. mike wallick * web application developer * [EMAIL PROTECTED] * 651.628.5377 * http://www.securecomputing.com __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. 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
RegExp help needed
Hello all, I have a text file that's a save of a bunch of messages from Outlook. The messages are error reports from CF sent with CFMail. The formatting sucks - I never expected to get a bunch - I was using it for debugging.. anyway, I have several hundred I need to parse. Silly transaction logs The layout is below. What I need to do is get the datetime string and the message ID from each instance of an error message in that file so I can update our database. start 'record' - x:\inetpub\domain\subdir\errorfile.cfmp DateTime: {ts '2002-01-06 00:44:09'}p URL Message_ID: 23660 p Message: ODBC Error Code = 37000 (Syntax error or access violation)Pp Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'dsdb' is full. Back up the transaction log for the database to free up some log space.PP end 'record' - The file has this format several hundred times over. Reading it in with cffile is simple. What I can't figure out is how to write the pattern matching code to extract the two variables. Also, the logic to make sure I have matching pairs is pretty easy - it's just the RegExps that are killing me. This is probably simple; I could write this in Perl but can't seem to do it in CF. Thanks in advance, Jeff __ Why Share? Dedicated Win 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=coldfusionc 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
Re: RegExp help needed
Try this: cffile action=READ file=foo variable=mf cfscript startpos=1; stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); while(startpos LT len(mf) and startpos GT 0 and stTime.pos[1] GT 0){ if(arraylen(stTime.pos) GT 1) timeval=mid(mf,stTime.pos[2],stTime.len[2]); else timeval=; writeoutput(timeval ---); startpos=stTime.pos[1]+stTime.len[1]; if(startpos GT 0){ stId=refindnocase(Message_Id\:[ ]*([^]*)p,mf,startpos,yes); if(arraylen(stId.pos) GT 1) idval=mid(mf,stId.pos[2],stId.len[2]); else idval=; writeoutput(idval br); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); } /cfscript HTH - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 10:43 AM Subject: RegExp help needed Hello all, I have a text file that's a save of a bunch of messages from Outlook. The messages are error reports from CF sent with CFMail. The formatting sucks - I never expected to get a bunch - I was using it for debugging.. anyway, I have several hundred I need to parse. Silly transaction logs The layout is below. What I need to do is get the datetime string and the message ID from each instance of an error message in that file so I can update our database. start 'record' - x:\inetpub\domain\subdir\errorfile.cfmp DateTime: {ts '2002-01-06 00:44:09'}p URL Message_ID: 23660 p Message: ODBC Error Code = 37000 (Syntax error or access violation)Pp Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'dsdb' is full. Back up the transaction log for the database to free up some log space.PP end 'record' - The file has this format several hundred times over. Reading it in with cffile is simple. What I can't figure out is how to write the pattern matching code to extract the two variables. Also, the logic to make sure I have matching pairs is pretty easy - it's just the RegExps that are killing me. This is probably simple; I could write this in Perl but can't seem to do it in CF. Thanks in advance, Jeff __ 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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: RegExp help needed
Holy cow, Don - I was hoping for some tips - you wrote the whole darn thingy! I'll test it right away - thanks mucho for the assist!! Regards, Jeff -Original Message- From: Don Vawter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:29 PM To: CF-Talk Subject: Re: RegExp help needed Try this: cffile action=READ file=foo variable=mf cfscript startpos=1; stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); while(startpos LT len(mf) and startpos GT 0 and stTime.pos[1] GT 0){ if(arraylen(stTime.pos) GT 1) timeval=mid(mf,stTime.pos[2],stTime.len[2]); else timeval=; writeoutput(timeval ---); startpos=stTime.pos[1]+stTime.len[1]; if(startpos GT 0){ stId=refindnocase(Message_Id\:[ ]*([^]*)p,mf,startpos,yes); if(arraylen(stId.pos) GT 1) idval=mid(mf,stId.pos[2],stId.len[2]); else idval=; writeoutput(idval br); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); } /cfscript HTH - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 10:43 AM Subject: RegExp help needed Hello all, I have a text file that's a save of a bunch of messages from Outlook. The messages are error reports from CF sent with CFMail. The formatting sucks - I never expected to get a bunch - I was using it for debugging.. anyway, I have several hundred I need to parse. Silly transaction logs The layout is below. What I need to do is get the datetime string and the message ID from each instance of an error message in that file so I can update our database. start 'record' - x:\inetpub\domain\subdir\errorfile.cfmp DateTime: {ts '2002-01-06 00:44:09'}p URL Message_ID: 23660 p Message: ODBC Error Code = 37000 (Syntax error or access violation)Pp Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'dsdb' is full. Back up the transaction log for the database to free up some log space.PP end 'record' - The file has this format several hundred times over. Reading it in with cffile is simple. What I can't figure out is how to write the pattern matching code to extract the two variables. Also, the logic to make sure I have matching pairs is pretty easy - it's just the RegExps that are killing me. This is probably simple; I could write this in Perl but can't seem to do it in CF. Thanks in advance, Jeff __ Why Share? Dedicated Win 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=coldfusionc 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
Re: RegExp help needed
Don't forget to cflock the call to cffile! :) Sam - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 2:18 PM Subject: RE: RegExp help needed Holy cow, Don - I was hoping for some tips - you wrote the whole darn thingy! I'll test it right away - thanks mucho for the assist!! Regards, Jeff -Original Message- From: Don Vawter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:29 PM To: CF-Talk Subject: Re: RegExp help needed Try this: cffile action=READ file=foo variable=mf cfscript startpos=1; stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); while(startpos LT len(mf) and startpos GT 0 and stTime.pos[1] GT 0){ if(arraylen(stTime.pos) GT 1) timeval=mid(mf,stTime.pos[2],stTime.len[2]); else timeval=; writeoutput(timeval ---); startpos=stTime.pos[1]+stTime.len[1]; if(startpos GT 0){ stId=refindnocase(Message_Id\:[ ]*([^]*)p,mf,startpos,yes); if(arraylen(stId.pos) GT 1) idval=mid(mf,stId.pos[2],stId.len[2]); else idval=; writeoutput(idval br); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); } /cfscript HTH - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 10:43 AM Subject: RegExp help needed Hello all, I have a text file that's a save of a bunch of messages from Outlook. The messages are error reports from CF sent with CFMail. The formatting sucks - I never expected to get a bunch - I was using it for debugging.. anyway, I have several hundred I need to parse. Silly transaction logs The layout is below. What I need to do is get the datetime string and the message ID from each instance of an error message in that file so I can update our database. start 'record' - x:\inetpub\domain\subdir\errorfile.cfmp DateTime: {ts '2002-01-06 00:44:09'}p URL Message_ID: 23660 p Message: ODBC Error Code = 37000 (Syntax error or access violation)Pp Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'dsdb' is full. Back up the transaction log for the database to free up some log space.PP end 'record' - The file has this format several hundred times over. Reading it in with cffile is simple. What I can't figure out is how to write the pattern matching code to extract the two variables. Also, the logic to make sure I have matching pairs is pretty easy - it's just the RegExps that are killing me. This is probably simple; I could write this in Perl but can't seem to do it in CF. Thanks in advance, Jeff __ Why Share? Dedicated Win 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=coldfusionc 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
Re: RegExp help needed
Had to write it to make sure regex worked lol - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 12:18 PM Subject: RE: RegExp help needed Holy cow, Don - I was hoping for some tips - you wrote the whole darn thingy! I'll test it right away - thanks mucho for the assist!! Regards, Jeff -Original Message- From: Don Vawter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 08, 2002 1:29 PM To: CF-Talk Subject: Re: RegExp help needed Try this: cffile action=READ file=foo variable=mf cfscript startpos=1; stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); while(startpos LT len(mf) and startpos GT 0 and stTime.pos[1] GT 0){ if(arraylen(stTime.pos) GT 1) timeval=mid(mf,stTime.pos[2],stTime.len[2]); else timeval=; writeoutput(timeval ---); startpos=stTime.pos[1]+stTime.len[1]; if(startpos GT 0){ stId=refindnocase(Message_Id\:[ ]*([^]*)p,mf,startpos,yes); if(arraylen(stId.pos) GT 1) idval=mid(mf,stId.pos[2],stId.len[2]); else idval=; writeoutput(idval br); startpos=stId.pos[1]+stId.len[1]; } if (startpos GT 0) stTime=refindnocase(DateTime\:[ ]*(\{[^\}]*\}),mf,startpos,yes); } /cfscript HTH - Original Message - From: Jeff Beer [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 10:43 AM Subject: RegExp help needed Hello all, I have a text file that's a save of a bunch of messages from Outlook. The messages are error reports from CF sent with CFMail. The formatting sucks - I never expected to get a bunch - I was using it for debugging.. anyway, I have several hundred I need to parse. Silly transaction logs The layout is below. What I need to do is get the datetime string and the message ID from each instance of an error message in that file so I can update our database. start 'record' - x:\inetpub\domain\subdir\errorfile.cfmp DateTime: {ts '2002-01-06 00:44:09'}p URL Message_ID: 23660 p Message: ODBC Error Code = 37000 (Syntax error or access violation)Pp Detail: [Microsoft][ODBC SQL Server Driver][SQL Server]The log file for database 'dsdb' is full. Back up the transaction log for the database to free up some log space.PP end 'record' - The file has this format several hundred times over. Reading it in with cffile is simple. What I can't figure out is how to write the pattern matching code to extract the two variables. Also, the logic to make sure I have matching pairs is pretty easy - it's just the RegExps that are killing me. This is probably simple; I could write this in Perl but can't seem to do it in CF. Thanks in advance, Jeff __ 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/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Quick regexp help
I wonder if there's anyone around who can help me with this... It's driving me crazy. I want a regexp to find a pattern starting with B , then any number of characters, until the first and replace it with \b (RTF markup). I have tried doing this, but it's not working: cfset cleantext = rereplacenocase(grubbytext,B[^]*,\b ,ALL) Anyone? K. __ Why Share? Dedicated Win 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=coldfusionc 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
Re: Quick regexp help
Are you sure that's a good description of what you want to do? The regex that you're using will do exactly that. This is Bbold/B text. becomes This is \b bold/B text. Jim - Original Message - From: Kay Smoljak [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, December 31, 2001 11:37 PM Subject: Quick regexp help I wonder if there's anyone around who can help me with this... It's driving me crazy. I want a regexp to find a pattern starting with B , then any number of characters, until the first and replace it with \b (RTF markup). I have tried doing this, but it's not working: cfset cleantext = rereplacenocase(grubbytext,B[^]*,\b ,ALL) Anyone? K. __ 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=coldfusiona 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
Re: Quick regexp help
Ummm... H... [shuffles feet]... Umm... Okay, thanks. I tried it again, refreshed and ctrl-refreshed a couple of times, and hey presto. Thanks. Jim McAtee [EMAIL PROTECTED] wrote in message news:024001c19291$e5e99bd0$0702a8c0@C1687485A... Are you sure that's a good description of what you want to do? The regex that you're using will do exactly that. This is Bbold/B text. becomes This is \b bold/B text. Jim - Original Message - From: Kay Smoljak [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, December 31, 2001 11:37 PM Subject: Quick regexp help I wonder if there's anyone around who can help me with this... It's driving me crazy. I want a regexp to find a pattern starting with B , then any number of characters, until the first and replace it with \b (RTF markup). I have tried doing this, but it's not working: cfset cleantext = rereplacenocase(grubbytext,B[^]*,\b ,ALL) Anyone? K. __ 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=coldfusiona 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
Regexp help
I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regexp help
Are you talking about UDFs? I have a custom tag that will scan a UDF library for UDFs and either generate HTML docs or return a structure. If you want the code, let me know. It's going to be downloadable once CFLib.org gets relaunched this week, but I can send you a copy now if you would like. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] ICQ UIN : 3679482 My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Bryan LaPlante [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 5:00 PM To: CF-Talk Subject: Regexp help I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regexp help
Assuming the test containing the source is a variable named text. the following will return a comma-delimited list of function names cfset myFunctions = Replace(text, @, , all) cfset myFunctions = ReplaceNoCase(myFunctions, function, @, all) cfset myFunctions = ReReplaceNoCase(myFunctions, [^@]*@[ ]+([a-z0-9_]+)[^@]*, \1,, all) HTH Dick At 3:59 PM -0500 7/17/01, Bryan LaPlante wrote: I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regexp help
refindnocase((function)(.)([[:graph::]]*)\(,thistag.generatedcontent,1,tru e) Marlon -Original Message- From: Bryan LaPlante [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 4:00 PM To: CF-Talk Subject: Regexp help I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regexp help
Oops, wrap problems... try: Assuming the test containing the source is a variable named text. the following will return a comma-delimited list of function names cfset myFunctions = Replace(text, @, , all) cfset myFunctions = ReplaceNoCase(myFunctions, function, @, all) cfset myFunctions = ReReplaceNoCase(myFunctions, [^@]*@[ ]+([a-z0-9_]+)[^@]*, \1,, all) HTH Dick At 3:59 PM -0500 7/17/01, Bryan LaPlante wrote: I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regexp help
how do i go about using these results? after running your regex, i imagine you get a structure returned whose keys are len and pos. you could then use those in the mid function to retrieve the string. however, when i run: cfset testvar='function addition(a,b){ somevar = a + b; return somevar; } ' cfset regextestvar=refindnocase((function)(.)([[:graph::]]*)\(,testvar,1,true) cfoutput cfloop collection=#regextestvar# item=key #key#:: #regextestvar[key]# /cfloop /cfoutput i get: Error Diagnostic Information Expression result cannot be converted to a string Expressions used inside tags like CFOUTPUT, CFQUERY, CFMAIL, etc. must evaluate to a value that can be converted to a string for output or dynamic text accumulation purposes. Complex objects, such as queries, arrays, and COM/DCOM objects, cannot be represented as strings. ? -Original Message- From: Marlon Moyer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 7:24 PM To: CF-Talk Subject: RE: Regexp help refindnocase((function)(.)([[:graph::]]*)\(,thistag.generatedcontent,1,tru e) Marlon -Original Message- From: Bryan LaPlante [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 17, 2001 4:00 PM To: CF-Talk Subject: Regexp help I need some help from one of the RegExp guru's. I am trying to get a list of function names from my page for example the following functions name resides in the page at position 9 to 17. I need a regular expression that will find everything between the word function and the parenthesis character ( so that I can get the word addition into a list. Here is what I have so far. cfset funcName = refindnocase(([function]+) [ ]+ \(,thistag.generatedcontent,1,true) function addition(a,b){ somevar = a + b; return somevar; } Bryan LaPlante ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists