Regular Expression Help
I have a regular expression issue. I have information that says: ~{Test Information/a/li That in a series of processing should look like ~{Test Information}~/a/li Any idea in a rereplace how I can replace anything that is ~{*/a/li with ~{*}~/a/li Thanks Pat - Patrick Kerley kerl...@yahoo.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345259 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regular Expression Help
If you'd like you can use the underlying java implementation of replaceAll. Cfset str = ~{Test Information2/a/li~{Test Information/a/li~{Test Information4/a/li~{Test Information/a/li / cfdump var=#str.replaceAll( ([a-zA-Z0-9])/a/li, $1}~/a/li )# / Should show: ~{Test Information2}~/a/li~{Test Information}~/a/li~{Test Information4}~/a/li~{Test Information}~/a/li -Pat On Tue, Jun 14, 2011 at 7:49 AM, Patrick Kerley kerl...@yahoo.com wrote: I have a regular expression issue. I have information that says: ~{Test Information/a/li That in a series of processing should look like ~{Test Information}~/a/li Any idea in a rereplace how I can replace anything that is ~{*/a/li with ~{*}~/a/li Thanks Pat - Patrick Kerley kerl...@yahoo.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345260 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regular Expression Help
This might be more of what you are looking for. It captures special characters as well and should fit more in line to what you want. Cfset str = ~{Test Infor$%mation2$/a/li~{Test Information/a/li~{Test Information4/a/li~{Test Information/a/li / cfdump var=#str.replaceAll( (~\{.*?)/a/li, $1}~/a/li )# / 2011/6/14 Patrick Santora patwe...@gmail.com If you'd like you can use the underlying java implementation of replaceAll. Cfset str = ~{Test Information2/a/li~{Test Information/a/li~{Test Information4/a/li~{Test Information/a/li / cfdump var=#str.replaceAll( ([a-zA-Z0-9])/a/li, $1}~/a/li )# / Should show: ~{Test Information2}~/a/li~{Test Information}~/a/li~{Test Information4}~/a/li~{Test Information}~/a/li -Pat On Tue, Jun 14, 2011 at 7:49 AM, Patrick Kerley kerl...@yahoo.com wrote: I have a regular expression issue. I have information that says: ~{Test Information/a/li That in a series of processing should look like ~{Test Information}~/a/li Any idea in a rereplace how I can replace anything that is ~{*/a/li with ~{*}~/a/li Thanks Pat - Patrick Kerley kerl...@yahoo.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345265 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regular Expression Help
Give this a go: cfset Result = InputText.replaceAll ( '~\{(?:(?!/a).)+(?!\}~)(?=/a/li)' , '$0}~' ) / It uses the java replaceAll regex function so that it can do the negative lookbehind to ensure existing correct items are not changed, meaning it can be run multiple times. Accepts any character (except newline) until it finds a closing A tag. If newlines are required, that's just a one character change: '~\{(?s:(?!/a).)+(?!\}~)(?=/a/li)' (Which adds the 's' flag into what was a non-capturing group, meaning '.' also matches newlines.) If there's the possibly of a '~{' appearing outside this context, it may need extra limits applied to work correctly. Assuming there should not be any tags inside the ~{...}~ part, I would change the '.' for a '[^]' which makes it a bit 'safer': '~\{(?:(?!/a)[^])+(?!\}~)(?=/a/li)' ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345282 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regular Expression Help
Thanks that did it. I hate regular expressions (or maybe am in awe of their power) but you're my new best friend. - Patrick Kerley kerl...@yahoo.com - From: Peter Boughton bought...@gmail.com To: cf-talk cf-talk@houseoffusion.com Sent: Tuesday, June 14, 2011 12:16 PM Subject: Re: Regular Expression Help Give this a go: cfset Result = InputText.replaceAll ( '~\{(?:(?!/a).)+(?!\}~)(?=/a/li)' , '$0}~' ) / It uses the java replaceAll regex function so that it can do the negative lookbehind to ensure existing correct items are not changed, meaning it can be run multiple times. Accepts any character (except newline) until it finds a closing A tag. If newlines are required, that's just a one character change: '~\{(?s:(?!/a).)+(?!\}~)(?=/a/li)' (Which adds the 's' flag into what was a non-capturing group, meaning '.' also matches newlines.) If there's the possibly of a '~{' appearing outside this context, it may need extra limits applied to work correctly. Assuming there should not be any tags inside the ~{...}~ part, I would change the '.' for a '[^]' which makes it a bit 'safer': '~\{(?:(?!/a)[^])+(?!\}~)(?=/a/li)' ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345293 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Regular Expression help
Please help, banging my head against a wall and my deadline is up... I need to search a text filed of html formatted text to see if the user enter in bad words I have it all set to go but the regexp is giving me trouble. I am looping over the list of badwords and checking the variable skills. cfif REFindnocase(([\]+#badword#+[\]),skills) The issue is that if the word kiss is a bad word I need to be able to flag it if it is wrapped by html tags i.e. brkiss the pony/br and I only want kiss not kissing. Please help with the regexp to get this done. Thank you in advance. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314653 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression help
I think you want something like this: cfif REFindnocase(([\s\]#badword#[\s\]),skills) You may want to expand it to non-alphanumeric wrappers, though, to catch punctuation: he gave her a kiss. cfif REFindnocase(([\W]#badword#[\W]),skills) which is the same as cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),skills) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314656 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression help
Not sure what I am doing wrong but this is not working. I have the string kissess are goodbrkissbrthe girlfriend Kiss is a badword, and this regexp is not picking it up. Please advise and thanks for your help. Matt I think you want something like this: cfif REFindnocase(([\s\]#badword#[\s\]),skills) You may want to expand it to non-alphanumeric wrappers, though, to catch punctuation: he gave her a kiss. cfif REFindnocase(([\W]#badword#[\W]),skills) which is the same as cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),skills) ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314666 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression help
Hm, that should work, certainly. Did you try that 3rd option? cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),skills) That should find any use of the word 'kiss' when it's surrounded by any non-alpha characters. Sadly I don't have access to my CF environment right at the moment, so I can't test :( Not sure what I am doing wrong but this is not working. I have the string kissess are goodbrkissbrthe girlfriend Kiss is a badword, and this regexp is not picking it up. Please advise and thanks for your help. Matt ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314667 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression help
Forgot about Ryan Swanson's slick little tool. It certainly validates and picks up the middle 'kiss' in his validator, using either '\W' or '^a-zA-Z0-9_' as the filter: http://ryanswanson.com/regexp/#start ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314668 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression help
Figured out the issue, this works great. Thank you, thank you, thank you ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314673 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression help
I just found an issue with this regexp cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),clean_skills) this works great if it is not the first word or only word in the string. what do I need to do to update the regexp to pick up the bad word it is the first last or only word in the string also. Thank you again for all of your help. Matt ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314686 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression help
Typo: cfif REFindnocase(((^|\W)#badword#(\W|$)),clean_skills) On Fri, Oct 31, 2008 at 1:09 PM, Sonny Savage [EMAIL PROTECTED] wrote: cfif REFindnocase(((^|\W)#badword#(\W|$),clean_skills) On Fri, Oct 31, 2008 at 1:04 PM, Matthew Friedman [EMAIL PROTECTED]wrote: I just found an issue with this regexp cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),clean_skills) this works great if it is not the first word or only word in the string. what do I need to do to update the regexp to pick up the bad word it is the first last or only word in the string also. Thank you again for all of your help. Matt ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314687 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression help
Good call. Try this, seems to work in initial testing: cfif REFindnocase(((^|[^a-zA-Z0-9_])#badword#([^a-zA-Z0-9_]|$)), clean_skills) I just found an issue with this regexp cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]), clean_skills) this works great if it is not the first word or only word in the string. what do I need to do to update the regexp to pick up the bad word it is the first last or only word in the string also. Thank you again for all of your help. Matt ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314688 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression help
cfif REFindnocase(((^|\W)#badword#(\W|$),clean_skills) On Fri, Oct 31, 2008 at 1:04 PM, Matthew Friedman [EMAIL PROTECTED] wrote: I just found an issue with this regexp cfif REFindnocase(([^a-zA-Z0-9_]#badword#[^a-zA-Z0-9_]),clean_skills) this works great if it is not the first word or only word in the string. what do I need to do to update the regexp to pick up the bad word it is the first last or only word in the string also. Thank you again for all of your help. Matt ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314689 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression Help on Email Addresses
I am working on a variable mask version as I have time. This one will atleast mask the domain for now. Eric On 2/20/07, Eric Haskins [EMAIL PROTECTED] wrote: cfset email = ReReplaceNocase(email, ([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}), [EMAIL PROTECTED])/ Try this one Eric ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270297 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression Help on Email Addresses
cfset variables.domainlen = Len(ReReplaceNocase(attributes.email, ([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}), \2)) - 1 cfset variables.mask = cfloop from=1 to=#variables.domainlen# index=i cfset variables.mask = variables.mask * /cfloop cfset variables.email = ReReplaceNocase(attributes.email, ([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}), [EMAIL PROTECTED])/ Kind of a hack Im sure it can be done better but this works. Im still learning :) -- ~Eric ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270312 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Regular Expression Help on Email Addresses
I would like to use a regular expression to camouflage email addresses in a forum I'm building. I'd like to replace just the domain name (not the .com or .net or other extension though) with x's: FROM THIS: [EMAIL PROTECTED] TO THIS:[EMAIL PROTECTED] Where the number of x's exactly matches the number of characters replaced. Make sense? It should work with kludgy domain names having dashes in them too (are there any other characters allowed? I don't think so) like so: FROM THIS: [EMAIL PROTECTED] TO THIS: [EMAIL PROTECTED] Can anyone help me out with this? TIA Karl S. ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270251 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regular Expression Help on Email Addresses
I would like to use a regular expression to camouflage email addresses in a forum I'm building. I'd like to replace just the domain name (not the .com or .net or other extension though) with x's: FROM THIS: [EMAIL PROTECTED] TO THIS:[EMAIL PROTECTED] Where the number of x's exactly matches the number of characters replaced. Make sense? It should work with kludgy domain names having dashes in them too (are there any other characters allowed? I don't think so) like so: FROM THIS: [EMAIL PROTECTED] TO THIS: [EMAIL PROTECTED] Can anyone help me out with this? TIA Karl S. ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270252 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help on Email Addresses
cfset email = ReReplaceNocase(email, ([a-zA-Z0-9_\-\.]+)@((([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}), [EMAIL PROTECTED])/ Try this one Eric On 2/20/07, K Simanonok [EMAIL PROTECTED] wrote: I would like to use a regular expression to camouflage email addresses in a forum I'm building. I'd like to replace just the domain name (not the .com or .net or other extension though) with x's: FROM THIS: [EMAIL PROTECTED] TO THIS:[EMAIL PROTECTED] Where the number of x's exactly matches the number of characters replaced. Make sense? It should work with kludgy domain names having dashes in them too (are there any other characters allowed? I don't think so) like so: FROM THIS: [EMAIL PROTECTED] TO THIS: [EMAIL PROTECTED] Can anyone help me out with this? TIA Karl S. ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270255 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regular Expression Help on Email Addresses
I would like to use a regular expression to camouflage email addresses in a forum I'm building. I'd like to replace just the domain name (not the .com or .net or other extension though) with x's: FROM THIS: [EMAIL PROTECTED] TO THIS:[EMAIL PROTECTED] Where the number of x's exactly matches the number of characters replaced. Make sense? It should work with kludgy domain names having dashes in them too (are there any other characters allowed? I don't think so) like so: FROM THIS: [EMAIL PROTECTED] TO THIS: [EMAIL PROTECTED] Can anyone help me out with this? TIA Karl S. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270259 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help on Email Addresses
Offhand, I think your best bet is to use a regex to identify everything from the @ to the TLD, then use the len returned by refind to do a replace of it. There are a number of really good regexes for finding/dissecting emails out there. CFLib.org is a good place to start. --Ben Doom K Simanonok wrote: I would like to use a regular expression to camouflage email addresses in a forum I'm building. I'd like to replace just the domain name (not the .com or .net or other extension though) with x's: FROM THIS: [EMAIL PROTECTED] TO THIS:[EMAIL PROTECTED] Where the number of x's exactly matches the number of characters replaced. Make sense? It should work with kludgy domain names having dashes in them too (are there any other characters allowed? I don't think so) like so: FROM THIS: [EMAIL PROTECTED] TO THIS: [EMAIL PROTECTED] Can anyone help me out with this? TIA Karl S. ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270270 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regular Expression Help
How would you do numbers under one hundred with a limit of 7 decimals? Lee Surma Applications Systems Engineer Wells Fargo Corporate Trust [EMAIL PROTECTED] 612-667-4066 ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267944 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help
Not really sure what exactly you are looking to do, but the regular expression pattern for numbers under 100 with 7 decimals would be: \d{2}(\.\d{1,7})? This makes the decimal optional (with 1 to 7 decimal places). Of course, this does not protect AGAINST numbers over one hundred. For that you would need to use a java-style negative look behind (not available in standard CF RE functions): (?!\d{1})\d{2}(\.\d{1,7})?(?!\d{1}) This should make sure you only find the valid numbers ( I think ). .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, January 29, 2007 10:06 AM To: CF-Talk Subject: Regular Expression Help How would you do numbers under one hundred with a limit of 7 decimals? Lee Surma Applications Systems Engineer Wells Fargo Corporate Trust [EMAIL PROTECTED] 612-667-4066 ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267945 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression Help
Ben Nadel wrote: Not really sure what exactly you are looking to do, but the regular expression pattern for numbers under 100 with 7 decimals would be: \d{2}(\.\d{1,7})? I'd anchor it, assuming that this is supposed to be the whole string: ^\d{2}(\.\d{1,7})?$ --Ben Doom ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267960 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help
Well played. .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Monday, January 29, 2007 11:22 AM To: CF-Talk Subject: Re: Regular Expression Help Ben Nadel wrote: Not really sure what exactly you are looking to do, but the regular expression pattern for numbers under 100 with 7 decimals would be: \d{2}(\.\d{1,7})? I'd anchor it, assuming that this is supposed to be the whole string: ^\d{2}(\.\d{1,7})?$ --Ben Doom ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267962 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Regular Expression Help
That would not match 0 through 9.999 unless they were formatted into 2 digit numbers like 00, 01, etc... 09.999 It also wouldnt match anything between 1 and 0 like .999 unless it was formatted like 00.999 Try this one: ^\d{0,2}(\.\d{1,7})?$ I dont know what you are using it for but there is also the possibility of negative numbers. The above will not match them either. You could say ... if (regex matches number OR number LT 100) to get the negatives if it matters. cheers -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.17.14/657 - Release Date: 1/29/2007 9:04 AM ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267967 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Regular Expression Help....
Dave, While you probably don't need this anymore, I thought I would post it up here as your question inspired my blog post: http://www.bennadel.com/blog/487-Using-Verbose-Regular-Expressions-To-Ex plain-Url-Auto-Linking-In-ColdFusion.htm [ OR http://bennadel.com/index.cfm?dax=blog:486.view ] Cheers. .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 9:36 AM To: CF-Talk Subject: Regular Expression Help Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267457 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help....
Here's what I ended up using: https?:)\/\/))[-[:alnum:]\?%,\.\/##!@:=\+~_]+[A-Za-z0-9\/]) Thanks to Bobby Hartsfield for that! It seems to get everything I need and nothing I don't. Here's the whole function in case anyone wants it: function extractURLs(inputString) { var nPos=0; var lsURLs = ; var sDelimiter = chr(9); var nEndPos = ; var sLink = ; var sRegExp = https?:)\/\/))[-[:alnum:]\?%,\.\/##!@:=\+~_]+[A-Za-z0-9\/]); if(arrayLen(arguments) eq 2) { sDelimiter = arguments[2]; } nPos = reFindNoCase(sRegExp,inputString); while(nPos) { inputString = mid(inputString,nPos,len(inputString)); nEndPos = reFind(['#chr(34)# ],inputString); sLink = left(inputString,nEndPos-1); // Remove trailing slash if it exists so we don't end up with duplicates. if(right(sLink,1) EQ /) { sLink = left(sLink,len(sLink)-1); } if( NOT listFindNoCase(lsURLs, sLink, sDelimiter)) { lsURLs = listAppend(lsURLs, sLink, sDelimiter); } nEndPos = findNoCase(/a,inputString); inputString = mid(inputString,nEndPos+4,len(inputString)); nPos = reFindNoCase(sRegExp,inputString); } return lsURLs; } -Original Message- From: Eric Haskins [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 11:31 PM To: CF-Talk Subject: Re: Regular Expression Help Dave how did it turn out?? ~Eric ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267482 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regular Expression Help....
Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267304 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Regular Expression Help....
This page might get you pointed in the right direction. http://foad.org/~abigail/Perl/url2.html -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 8:36 AM To: CF-Talk Subject: Regular Expression Help Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267307 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help....
This one might be better: http://www.manamplified.org/archives/000318.html -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 9:50 AM To: CF-Talk Subject: RE: Regular Expression Help This page might get you pointed in the right direction. http://foad.org/~abigail/Perl/url2.html -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 8:36 AM To: CF-Talk Subject: Regular Expression Help Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267308 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression Help....
Thanks, I'm working on something with that now, but does anyone know if there is a function or tag out there someone has already written that does this? It seems that I should not be the first person who needs to feed a function a body of text and get back a list of the URL's in that text. Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267313 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help.... (Solution?)
I think I have a solution, but if a few of you could review and see if it can be any faster or more efficient (or if I'm missing something) I'd appreciate it. To find the end of the URL I'm looking for a single quote, double quote or space. function extractURLs(inputString) { var nPos=0; var lsURLs = ; var sDelimiter = chr(9); var nEndPos = ; var sLink = ; var sRegExp = ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?); if(arrayLen(arguments) eq 2) { sDelimiter = arguments[2]; } nPos = reFindNoCase(sRegExp,inputString); while(nPos) { inputString = mid(inputString,nPos,len(inputString)); nEndPos = reFind(['#chr(34)# ],inputString); sLink = left(inputString,nEndPos-1); if(NOT listFindNoCase(lsURLs,sLink,sDelimiter)) { lsURLs = listAppend(lsURLs, sLink, sDelimiter); } inputString = mid(inputString,nEndPos,len(inputString)); nPos = reFindNoCase(sRegExp,inputString); } return lsURLs; } Thanks! Dave Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267322 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help....
Dave, This snippet takes your regular expression and returns all matches in an array: http://www.bennadel.com/index.cfm?dax=snippets:11.view You can then take that and convert it to a list (but I would guess keeping it in an array is the way to go). After that, all you need is a good RegExp, which it looks like other people have already provided. Keep in mind, this snippet is for use with JAVA regular expression, which are slightly different but same idea. .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 9:55 AM To: CF-Talk Subject: Re: Regular Expression Help Thanks, I'm working on something with that now, but does anyone know if there is a function or tag out there someone has already written that does this? It seems that I should not be the first person who needs to feed a function a body of text and get back a list of the URL's in that text. Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267332 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help.... (Solution?)
Oh sorry, I didn't see the Solution email before I posted my last snippet. What you are doing below is fine. I cannot attest to the RegEx. You might want to try grabbing something of of RegExLib.com if you are unsure. I do know you should probably check for period . to end a URL, but do not confuse with file extension. URLs are a tricky beast. .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 10:25 AM To: CF-Talk Subject: Re: Regular Expression Help (Solution?) I think I have a solution, but if a few of you could review and see if it can be any faster or more efficient (or if I'm missing something) I'd appreciate it. To find the end of the URL I'm looking for a single quote, double quote or space. function extractURLs(inputString) { var nPos=0; var lsURLs = ; var sDelimiter = chr(9); var nEndPos = ; var sLink = ; var sRegExp = ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=- ])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0, 1000}))?); if(arrayLen(arguments) eq 2) { sDelimiter = arguments[2]; } nPos = reFindNoCase(sRegExp,inputString); while(nPos) { inputString = mid(inputString,nPos,len(inputString)); nEndPos = reFind(['#chr(34)# ],inputString); sLink = left(inputString,nEndPos-1); if(NOT listFindNoCase(lsURLs,sLink,sDelimiter)) { lsURLs = listAppend(lsURLs, sLink, sDelimiter); } inputString = mid(inputString,nEndPos,len(inputString)); nPos = reFindNoCase(sRegExp,inputString); } return lsURLs; } Thanks! Dave Hi, RegExp's are not my forte and I need to create a function that will extract URL's from a body of text and return it in a list. I have a function that extracts the anchor tags from a document, but I need to acurately extract the URL from that anchor tag. I can do a find for 'href' and so on, but the RIGHT regular expression would make sure all possibilities are covered like href=, href=' or href= or href = and so on. Can anyone help please? Thanks! Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267333 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular Expression Help....
Hi, The RegExp below is giving me more than I want. It is returning things that I don't want: mailto: urn:schemas-microsoft-com:office:office and others. I want to chnage it to only return url's starting with http: or https:. Here's what I currently have: ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) I think I want something like this, but it doesn't seem to be working right: ([http|https]:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) Can someone clear this up for me please? Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267361 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help....
When I test it tells me not enough ( I am troubleshooting it now out sick today but list draws me back everytime lol Eric On 1/23/07, Dave Phillips [EMAIL PROTECTED] wrote: Hi, The RegExp below is giving me more than I want. It is returning things that I don't want: mailto: urn:schemas-microsoft-com:office:office and others. I want to chnage it to only return url's starting with http: or https:. Here's what I currently have: ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) I think I want something like this, but it doesn't seem to be working right: ([http|https]:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) Can someone clear this up for me please? Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267363 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help....
Try this one https?:)\/\/)|(www\.|ftp\.))[-[:alnum:]\?%,\.\/##!@:=\+~_]+[A-Za-z0-9\/ ]) -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 2:03 PM To: CF-Talk Subject: Re: Regular Expression Help Hi, The RegExp below is giving me more than I want. It is returning things that I don't want: mailto: urn:schemas-microsoft-com:office:office and others. I want to chnage it to only return url's starting with http: or https:. Here's what I currently have: ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[ A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) I think I want something like this, but it doesn't seem to be working right: ([http|https]:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1, 333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) Can someone clear this up for me please? Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267365 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help....
(?:href=|href=|href=')((?:http|https)://(.+))(?:|'|) Does this help at all??? This will find all http or https links?? Eric On 1/23/07, Eric Haskins [EMAIL PROTECTED] wrote: When I test it tells me not enough ( I am troubleshooting it now out sick today but list draws me back everytime lol Eric On 1/23/07, Dave Phillips [EMAIL PROTECTED] wrote: Hi, The RegExp below is giving me more than I want. It is returning things that I don't want: mailto: urn:schemas-microsoft-com:office:office and others. I want to chnage it to only return url's starting with http: or https:. Here's what I currently have: ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) I think I want something like this, but it doesn't seem to be working right: ([http|https]:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) Can someone clear this up for me please? Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267366 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regular Expression Help....
Oops, that had ftp in it... Try this... I took out the www since you apparently only wanted links that started with http:// and https:// https?:)\/\/))[-[:alnum:]\?%,\.\/##!@:=\+~_]+[A-Za-z0-9\/]) -Original Message- From: Dave Phillips [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 23, 2007 2:03 PM To: CF-Talk Subject: Re: Regular Expression Help Hi, The RegExp below is giving me more than I want. It is returning things that I don't want: mailto: urn:schemas-microsoft-com:office:office and others. I want to chnage it to only return url's starting with http: or https:. Here's what I currently have: ([A-Za-z][A-Za-z0-9+.-]{1,120}:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[ A-Fa-f0-9]{2}){1,333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) I think I want something like this, but it doesn't seem to be working right: ([http|https]:[A-Za-z0-9/](([A-Za-z0-9$_.+!*,;/?:@~=-])|%[A-Fa-f0-9]{2}){1, 333}(##([a-zA-Z0-9][a-zA-Z0-9$_.+!*,;/?:@~=%-]{0,1000}))?) Can someone clear this up for me please? Thanks, Dave ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267367 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expression Help....
Dave how did it turn out?? ~Eric ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267428 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Regular Expression Help
Hello Everybody, I'm having problems writing a regular expression. I'm trying to pass a string to flash and want to strip off and replace the html tags with a br tag but also leave any b, span, i, strong, div, br, and p tags. This is what I've done so far: cfscript function StripHTML(str) { return REReplaceNoCase(str,[^]*,br,ALL); } /cfscript cfse logtext = tabletrtdpThis is not real text/p/td/tr trtdbFriday 17 march, 2006/b/td/tr/table cfset str = StripHTML(logtext) The above function strips out any html tag and replaces it with a br tag. This is fine but I want to keep the span, i, b, strong, div, br, p tags and dont know how to tell it to ignore these tags and replace everything else with a and angle brackets. Can someone please help me with this. I am just not good at this sort of things. Thanks, cfcoder ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237716 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
Regular expression help
Hi, I have an url such as http://www.blah.com/something/somethingelse/default.cfm stored in a database. I wish to use this information as links to others site which have similar reviews. I would like to parse down the full url to on the domain i.e. http://www.blah.com http://www.blah.com/ - for display purposes. I have searched around trying to find an example and have been unsuccessful. Does anyone have any pointers to how to parse the domain out of the url? The nearest I have found is #REReplace(getsimilarlinks.linkurl,\?.*$,)#. Thanks, John Interested in Hiking in Washington State? Check out http://www.attrition.ws http://www.attrition.ws/ ~| 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:214301 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: Regular expression help
-Original Message- From: John Munyan [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 3:03 AM To: CF-Talk Subject: Regular expression help Hi, I have an url such as http://www.blah.com/something/somethingelse/default.cfm stored in a database. I wish to use this information as links to others site which have similar reviews. I would like to parse down the full url to on the domain i.e. http://www.blah.com http://www.blah.com/ - for display purposes. I have searched around trying to find an example and have been unsuccessful. Does anyone have any pointers to how to parse the domain out of the url? The nearest I have found is #REReplace(getsimilarlinks.linkurl,\?.*$,)#. If all of your links are fully formed like that you don't need regexs at all - just treat the URL as a list delimited by a forward slash (/). Since CF condenses multiple delimiters I think this will give you your URL: cfset Link = http://www.blah.com/something/somethingelse/default.cfm / cfset JustDomainLink = ListGetAt(Link, 1, /) // ListGetAt(Link, 2, /) / Using the ListGetAt() for the first part (the protocol) is important to catch none http links like https: and ftp:. Jim Davis ~| 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:214303 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
Regular Expression help
Guys, I have the following email check but it won't accept a .info email address. I'm not a regular expression expert and was hoping someone could help me out with this. How could I update the following script to accept domain suffixes other than .com, .net .org? function isEmail(str) { // are regular expressions supported? var supported = 0; if (window.RegExp) { var tempStr = a; var tempReg = new RegExp(tempStr); if (tempReg.test(tempStr)) supported = 1; } if (!supported) return (str.indexOf(.) 2) (str.indexOf(@) 0); var r1 = new RegExp((@.*@)|(\\.\\.)|(@\\.)|(^\\.)); var r2 = new RegExp(^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$); return (!r1.test(str) r2.test(str)); } Rey... ~| 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:208093 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: Regular Expression help
I found the fix guys!!! Amazing what a little Googling will do. :P Rey... Rey Bango wrote: Guys, I have the following email check but it won't accept a .info email address. I'm not a regular expression expert and was hoping someone could help me out with this. How could I update the following script to accept domain suffixes other than .com, .net .org? function isEmail(str) { // are regular expressions supported? var supported = 0; if (window.RegExp) { var tempStr = a; var tempReg = new RegExp(tempStr); if (tempReg.test(tempStr)) supported = 1; } if (!supported) return (str.indexOf(.) 2) (str.indexOf(@) 0); var r1 = new RegExp((@.*@)|(\\.\\.)|(@\\.)|(^\\.)); var r2 = new RegExp(^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$); return (!r1.test(str) r2.test(str)); } Rey... ~| 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:208095 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
Regular Expression Help
I'm searching a long string and looking for the value input type=hidden name=BV_SessionID value=any value here what kind of syntax would I use to grab the value of the above tag. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183457 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: Regular Expression Help
REReplaceNoCase(text,'^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1) Pascal -Original Message- From: Daniel Farmer [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 10:24 To: CF-Talk Subject: Regular Expression Help I'm searching a long string and looking for the value input type=hidden name=BV_SessionID value=any value here what kind of syntax would I use to grab the value of the above tag. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183458 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: Regular Expression Help
Thanks Pascal... but I am having problems implementing cfset theval = #REFind('^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1,)#, cfhttp.filecontent, startpos )# ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183459 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: Regular Expression Help
Pascal, Would it be possible for you to explain a bit more about what each part of the RegEx is doing? I'm trying to do something similar and I'm having no end of trouble getting the RegEx right. MM documentation is pretty thin on more advanced matching. Thanks, Gavin -Original Message- From: Pascal Peters [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 10:43 To: CF-Talk Subject: RE: Regular Expression Help REReplaceNoCase(text,'^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1) Pascal -Original Message- From: Daniel Farmer [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 10:24 To: CF-Talk Subject: Regular Expression Help I'm searching a long string and looking for the value input type=hidden name=BV_SessionID value=any value here what kind of syntax would I use to grab the value of the above tag. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183461 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: Regular Expression Help
cfset theval = REReplaceNoCase(cfhttp.filecontent,'^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1) Pascal -Original Message- From: Daniel Farmer [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 11:10 To: CF-Talk Subject: Re: Regular Expression Help Thanks Pascal... but I am having problems implementing cfset theval = #REFind('^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1,)#, cfhttp.filecontent, startpos )# ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183462 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: Regular Expression Help
^ beginning of string .* any character, any number of times ... literal string ([^]*) any character except , any number of times (grouped for backreferencing) .* see above $ end of string The \1 matches the first group saved for backreferencing. I forgot the quotes in my original post. If you are looking for resources: Printed: - Ben Forta's book is very good for beginners - Mastering Regular Expressions frm O'Reilly (the regexp bible, more advanced) Online: http://www.regular-expressions.info/ Pascal -Original Message- From: Gavin Brook [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 12:11 To: CF-Talk Subject: RE: Regular Expression Help Pascal, Would it be possible for you to explain a bit more about what each part of the RegEx is doing? I'm trying to do something similar and I'm having no end of trouble getting the RegEx right. MM documentation is pretty thin on more advanced matching. Thanks, Gavin -Original Message- From: Pascal Peters [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 10:43 To: CF-Talk Subject: RE: Regular Expression Help REReplaceNoCase(text,'^.*input type=hidden name=BV_SessionID value=([^]*).*$',\1) Pascal -Original Message- From: Daniel Farmer [mailto:[EMAIL PROTECTED] Sent: 05 November 2004 10:24 To: CF-Talk Subject: Regular Expression Help I'm searching a long string and looking for the value input type=hidden name=BV_SessionID value=any value here what kind of syntax would I use to grab the value of the above tag. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183463 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
Regular expression help with dictionary definitions
Ok, This one is killing me.. And my CFMX server... Currently I'm using the following code to parse some text: cfset teststr = definition cfset st = ReFindNoCase({[^}]*}, teststr, 1, true) cfloop condition=st.pos[1] GT 0 cfset replaceme = mid(teststr, st.pos[1], st.len[1]) cfset theword = mid(replaceme, 2, len(replaceme)-2) cfset teststr = ReplaceNoCase(teststr, replaceme, a href=""> heword#/a, all) cfset st = ReFindNoCase({[^}]*}, teststr, 1, true) /cfloop The text usually resembles something like the first example below and by the time the parser has run, everything inside the parentheses are turned into hyperlinks.. Fungi \Fungi\, n. pl. (Bot.) A group of thallophytic plants of low organization, destitute of chlorophyll, in which reproduction is mainly accomplished by means of asexual spores, which are produced in a great variety of ways, though sexual reproduction is known to occur in certain {Phycomycetes}, or so-called algal fungi. Note: The Fungi appear to have originated by degeneration from various alg[ae], losing their chlorophyll on assuming a parasitic or saprophytic life. By some they are divided into the subclasses {Phycomycetes}, the lower or algal fungi; the {Mesomycetes}, or intermediate fungi; and the {Mycomycetes}, or the higher fungi; by others into the {Phycomycetes}; the {Ascomycetes}, or sac-spore fungi; and the {Basidiomycetes}, or basidial-spore fungi. My problem is that I have just discovered is that of nested parentheses... Using the code above the process goes into an infinite loop and eats all available RAM in about 30 seconds The following text kills my algorithm! Cryptogamia \Cryp`to*gami*a\ (kr?p`t?-g?m?-?), n.; pl. {Cryptogami[ae]} (-?). [NL., fr. Gr. krypto`s hidden, secret + ga`mos marriage.] (Bot.) The series or division of flowerless plants, or those never having true stamens and pistils, but propagated by spores of various kinds. Note: The subdivisions have been variously arranged. The following arrangement recognizes four classes: -- I. {{Pteridophyta}, or {Vascular Acrogens}.} These include Ferns, {Equiseta} or Scouring rushes, {Lycopodiace[ae]} or Club mosses, {Selaginelle[ae]}, and several other smaller orders. Here belonged also the extinct coal plants called {Lepidodendron}, {Sigillaria}, and {Calamites}. II. {{Bryophita}, or {Cellular Acrogens}}. These include {Musci}, or Mosses, {Hepatic[ae]}, or Scale mosses and Liverworts, and possibly {Charace[ae]}, the Stoneworts. III. {{Alg[ae]}}, which are divided into {Floride[ae]}, the Red Seaweeds, and the orders {Dictyote[ae]}, {O[o]spore[ae]}, {Zo[o]spore[ae]}, {Conjugat[ae]}, {Diatomace[ae]}, and {Cryptophyce[ae]}. IV. {{Fungi}}. The molds, mildews, mushrooms, puffballs, etc., which are variously grouped into several subclasses and many orders. The {Lichenes} or Lichens are now considered to be of a mixed nature, each plant partly a Fungus and partly an Alga. One solution would be to repeatedly pre-parse the text to remove or escape the extra parentheses but I'm not inclined to do this as I believe I should be able to fix my regular _expression_ which is currently {[^}]*}. Does anyone have any suggestions??? Thanks in advance Paul [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular expression help with dictionary definitions
If this is the actual code you are using, you are creating an infinite loop because you always start looking at the start position 1 in your REFind. It will keep matching the first {}. It really depends what you are trying to grab. If you are trying to get only the inner parentheses it is not too hard. Now for the solution: teststr = REReplaceNoCase(teststr,\{([^{}]+)\},{a href=""> },all); Not tested, but it should work. Pascal -Original Message- From: Paul Vernon [mailto:[EMAIL PROTECTED] Sent: 13 July 2004 18:17 To: CF-Talk Subject: Regular _expression_ help with dictionary definitions Ok, This one is killing me.. And my CFMX server... Currently I'm using the following code to parse some text: cfset teststr = definition cfset st = ReFindNoCase({[^}]*}, teststr, 1, true) cfloop condition=st.pos[1] GT 0 cfset replaceme = mid(teststr, st.pos[1], st.len[1]) cfset theword = mid(replaceme, 2, len(replaceme)-2) cfset teststr = ReplaceNoCase(teststr, replaceme, a href=""> #t heword#/a, all) cfset st = ReFindNoCase({[^}]*}, teststr, 1, true) /cfloop [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: FIXED - Regular expression help with dictionary definitions
Sorry for the original and long post... I fixed it... The regular _expression_ changed to {[^{^}]*} and I changed the startpos for the next REFindNoCase so it skipped the nesting issues... cfset st = ReFindNoCase({[^{^}]*}, teststr, 1, true) cfloop condition=st.pos[1] GT 0 cfset replaceme = mid(teststr, st.pos[1], st.len[1]) cfset theword = mid(replaceme, 2, len(replaceme)-2) cfset replacestr = a href=""> heword#/a cfset teststr = ReplaceNoCase(teststr, replaceme, replacestr, all) cfset st = ReFindNoCase({[^{^}]*}, teststr, st.pos[1]+len(replacestr), true) /cfloop Paul [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: FIXED - Regular expression help with dictionary definitions
This is not exactly what you are trying to say: [^{^}] == anything but { or } or ^ Correct: [^{}] Pascal PS Give the REReplace with the backreferencing (see my previous post) a shot. It is only 1 line to do the same thing. -Original Message- From: Paul Vernon [mailto:[EMAIL PROTECTED] Sent: 13 July 2004 18:45 To: CF-Talk Subject: RE: FIXED - Regular _expression_ help with dictionary definitions Sorry for the original and long post... I fixed it... The regular _expression_ changed to {[^{^}]*} and I changed the startpos for the next REFindNoCase so it skipped the nesting issues... [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: FIXED - Regular expression help with dictionary definitions
PS Give the REReplace with the backreferencing (see my previous post) a shot. It is only 1 line to do the same thing. Pascal, you are a STAR! The backreferencing wasn't quite there as I wanted to remove all of the extra parentheses also but a simple replacelist wrapped around your elegant solution fixed that... The results can be seen at http://www.web-architect.co.uk/cfx_dict.cfm?dictionary=web1913 http://www.web-architect.co.uk/cfx_dict.cfm?dictionary=web1913phrase=Fungi phrase=Fungi Thanks again Paul [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: FIXED - Regular expression help with dictionary definitions
Don't do the replace, just don't include the {} in the REreplace. Although I may have overlooked something: You really should do a URLEncodedFormat() of the word (which doesn't work with the backreferencing). function MakeLinks(text,dictionary){ var st = StructNew(); var start = 1; var word = ; var link = ; while(true){ st = REFind(\{([^{}]+)\},text,start,true); if(st.pos[1] IS 0) break; word = Mid(text,st.pos[2],st.len[2]); text = RemoveChars(text,st.pos[1],st.len[1]); link = a href=""> dFormat(word)##word#/a ; text = Insert(link,text,st.pos[1]-1); start = st.pos[1] + Len(link); } return text; } Pascal -Original Message- From: Paul Vernon [mailto:[EMAIL PROTECTED] Sent: 13 July 2004 19:06 To: CF-Talk Subject: RE: FIXED - Regular _expression_ help with dictionary definitions PS Give the REReplace with the backreferencing (see my previous post) a shot. It is only 1 line to do the same thing. Pascal, you are a STAR! The backreferencing wasn't quite there as I wanted to remove all of the extra parentheses also but a simple replacelist wrapped around your elegant solution fixed that... The results can be seen at http://www.web-architect.co.uk/cfx_dict.cfm?dictionary=web1913 http://www.web- architect.co.uk/cfx_dict.cfm?dictionary=web1913phrase=Fungi phrase=Fungi Thanks again Paul [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expression Help
On CFMX stTmp = REFindNoCase('msg:(.*?);',str,1,true); if(stTmp.pos[1]){ message = Mid(str,stTmp.pos[2],stTmp.len[2]); } else { message = ; } ON CF5 stTmp = REFindNoCase('msg:(([^]|[^;])*);',str,1,true); if(stTmp.pos[1]){ message = Mid(str,stTmp.pos[2],stTmp.len[2]); } else { message = ; } -Original Message- From: Ian [mailto:[EMAIL PROTECTED] Sent: maandag 17 mei 2004 22:39 To: CF-Talk Subject: Regular _expression_ Help I'm trying to parse a string and pluck a bit of text, but my regex isn't working :( Here's a sample string: (msg:My Message Here; content:My Content Here;) I want to return My Message Here. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Regular Expression Help
I'm trying to parse a string and pluck a bit of text, but my regex isn't working :( Here's a sample string: (msg:My Message Here; content:My Content Here;) I want to return My Message Here. And here's my regex: refindnocase(msg:[[:print:]]+;, mystring) I'm using print as mystring may contain any printable characters. This returns 0 as the position. Any ideas? Ian [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular Expression Help
This should work. cfset test = (msg:My Message Here; content:My Content Here;) cfset temp = refindnocase(msg:([^;]*),test,1,yes) cfloop from=1 to=#arraylen(temp.pos)# index=i cfoutput#mid(test,temp.pos[i],temp.len[i])#br/cfoutput /cfloop -- Marlon Moyer, Sr. Internet Developer American Contractors Insurance Group phone: 972.687.9445 fax: 972.687.0607 mailto:[EMAIL PROTECTED] www.acig.com -Original Message- From: Ian [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 3:39 PM To: CF-Talk Subject: Regular _expression_ Help I'm trying to parse a string and pluck a bit of text, but my regex isn't working :( Here's a sample string: (msg:My Message Here; content:My Content Here;) I want to return My Message Here. And here's my regex: refindnocase(msg:[[:print:]]+;, mystring) I'm using print as mystring may contain any printable characters. This returns 0 as the position. Any ideas? Ian [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular expression help
cfscript regexp = ##[[:space:]]*([0-9]{2-3}); stTmp = REFindNoCase(regexp,str,1,true); if(stTmp.pos[1]) result = Mid(str,stTmp.pos[2],stTmp.len[2]); else result = ; /cfscript If you need to find all, you do it in a loop: cfscript regexp = ##[[:space:]]*([0-9]{2-3}); results = ArrayNew(1); start = 1; while(true){ stTmp = REFindNoCase(regexp,str,start,true); if(stTmp.pos[1]){ ArrayAppend(results,Mid(str,stTmp.pos[2],stTmp.len[2])); start = stTmp.pos[1] + stTmp.len[1]; } else break; } /cfscript Probably you want to make sure that the character after the 2-3 digits is not a digit. If so, modify the regexp to regexp = ##[[:space:]]*([0-9]{2-3})([^0-9]|$); On CFMX you could use negative lookahead: regexp = ##\s*(\d{2,3})(?!\d); Pascal -Original Message- From: Andy Ousterhout [mailto:[EMAIL PROTECTED] Sent: dinsdag 17 februari 2004 0:05 To: CF-Talk Subject: Regular _expression_ help What regular _expression_ would find a # followed by any number of blanks, followed by 2-3 numbers For example, I want to return 45 from this string: Testing this string # 45 to 46 Andy [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Regular expression help
What regular _expression_ would find a # followed by any number of blanks, followed by 2-3 numbers For example, I want to return 45 from this string: Testing this string # 45 to 46 Andy [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular expression help
How about this? cfset result = reFind(##[[:space:]]*([[:digit:]]+), myString, 1, true) cfif result.pos[1] cfoutput#mid(myString, result.pos[2], result.len[2])#/cfoutput /cfif -Original Message- From: Andy Ousterhout [mailto:[EMAIL PROTECTED] Sent: Tuesday, 17 February 2004 11:05 a.m. To: CF-Talk Subject: Regular _expression_ help What regular _expression_ would find a # followed by any number of blanks, followed by 2-3 numbers For example, I want to return 45 from this string: Testing this string # 45 to 46 Andy _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
I'm gonna need some regular expression help here...
Got a cfinput, it's required, and the validation is a regular _expression_. The Problem: The regular _expression_ isn't allowing a capital letter after the '@'. I'm sure there are other faults with this regular _expression_, but you see...I'm just not there yet when it comes to troubleshooting these things, so I thought I'd paste the relevant portion here hoping for some, miracle regular _expression_ person to jump in and gimme a hand. Ready? Here it is: validate=regular_expression pattern=^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.(([a-z]{2,3 })|(aero|coop|info|museum|name))$ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: I'm gonna need some regular expression help here...
Here's a nice little _expression_ I use. var chkEmail= /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{ 2})?)$/i; if ((form.Email.value.length 6 ) || (chkEmail.test(form.Email.value) == false)) { var msg= Email address entry error!\n\nPlease a valid email address!\n\nClick OK to continue.; alert (msg); form.Email.focus(); return false; } ~Dave -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Monday, October 13, 2003 11:42 AM To: CF-Talk Subject: I'm gonna need some regular _expression_ help here... Got a cfinput, it's required, and the validation is a regular _expression_. The Problem: The regular _expression_ isn't allowing a capital letter after the '@'. I'm sure there are other faults with this regular _expression_, but you see...I'm just not there yet when it comes to troubleshooting these things, so I thought I'd paste the relevant portion here hoping for some, miracle regular _expression_ person to jump in and gimme a hand. Ready? Here it is: validate=regular_expression pattern=^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.(([a-z]{2,3 })|(aero|coop|info|museum|name))$ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: I'm gonna need some regular expression help here...
This regex was intended to be used with a case-insensitive regular _expression_ checker.To make it case insensitive, there are two things you'll have to do. replace a-z in brackets with a-zA-Z replace each of aero, coop, info, museum, and name with EVERYPOSSIBLE CAPITALIZATION POSSIBILITY. If I were you, I would probably do my email format validation on the backend. --Ben Doom Jeff wrote: Got a cfinput, it's required, and the validation is a regular _expression_. The Problem: The regular _expression_ isn't allowing a capital letter after the '@'. I'm sure there are other faults with this regular _expression_, but you see...I'm just not there yet when it comes to troubleshooting these things, so I thought I'd paste the relevant portion here hoping for some, miracle regular _expression_ person to jump in and gimme a hand. Ready? Here it is: validate=regular_expression pattern=^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.(([a-z]{2,3 })|(aero|coop|info|museum|name))$ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: I'm gonna need some regular expression help here...
On Monday 13 Oct 2003 17:01 pm, Ben Doom wrote: replace each of aero, coop, info, museum, and name with EVERYPOSSIBLE CAPITALIZATION POSSIBILITY. Or alternatively, don't bother checking the TLD against a static list, because eventualy a new one will crop up, and you'll wind people up who have one. There are still sites I can't use with my .info address. -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: I'm gonna need some regular expression help here...
I use: ^[a-zA-Z]([.]?([[:alnum:]_-]+[.]?)*[[:alnum:]_-])?@([[:alnum:]\-_]+\.)+[a-zA-Z]{2,4}$ which, admittedly, won't allow .museum addresses, but will match most common emails. --Ben Doom Thomas Chiverton wrote: On Monday 13 Oct 2003 17:01 pm, Ben Doom wrote: replace each of aero, coop, info, museum, and name with EVERYPOSSIBLE CAPITALIZATION POSSIBILITY. Or alternatively, don't bother checking the TLD against a static list, because eventualy a new one will crop up, and you'll wind people up who have one. There are still sites I can't use with my .info address. -- Tom Chiverton Advanced ColdFusion Programmer Tel: +44(0)1749 834997 email: [EMAIL PROTECTED] BlueFinger Limited Underwood Business Park Wookey Hole Road, WELLS. BA5 1AF Tel: +44 (0)1749 834900 Fax: +44 (0)1749 834901 web: www.bluefinger.com Company Reg No: 4209395 Registered Office: 2 Temple Back East, Temple Quay, BRISTOL. BS1 6EG. *** This E-mail contains confidential information for the addressee only. If you are not the intended recipient, please notify us immediately. You should not use, disclose, distribute or copy this communication if received in error. No binding contract will result from this e-mail until such time as a written document is signed on behalf of the company. BlueFinger Limited cannot accept responsibility for the completeness or accuracy of this message as it has been transmitted over public networks.*** [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Regular Expression Help
Ok I suck at reg expressions.Basically I have some data and within the data there is some stuff I want to remove.Example text text a href="" href="http://www.blah.comblah">http://www.blah.comblah blah blah blah/a text text Ok basically I want to remove everything from a href through /a although it will be different on every line. So I need code that will look for a href and the ending of /a and remove all text inbetween (including the a href and /a of course.) leaving just text text text text.(note text is simply an example the verbiage will differ everytime, the only consistency is the a href etc. SUggestions? Kelly [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Regular Expression Help
What version of CF?--Ben the RegEx Ninja Doomkelly wrote:Ok I suck at reg expressions.Basically I have some data and within the data there is some stuff I want to remove.Example text text a href="" href="http://www.blah.comblah">http://www.blah.comblah http://www.blah.comblah blah blah blah/a text text Ok basically I want to remove everything from a href through /a although it will be different on every line. So I need code that will look for a href and the ending of /a and remove all text inbetween (including the a href and /a of course.) leaving just text text text text.(note text is simply an example the verbiage will differ everytime, the only consistency is the a href etc. SUggestions? Kelly [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Regular Expression Help
Ok basically I want to remove everything from a href through /a althoughit will be different on every line.This is tipically the situation why I developed CF_REextract (seehttp://www.contentbox.com/claude/customtags/tagstore.cfm?p=hf(see specs and examples)The tag will find all occurences, and return then in a query.You can then loop in the query and rebuild the string with the parts you want simply using the mid() function.The tag will even get your file from disk or HTTP the page for you if you want. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Repost: Regular Expression Help
I tried to post this yesterday from the archives and I screwed it up. So.. reposting. I am dealing with a site that has been ripped apart by search and replace in Homesite+. Tags that used to look like: td select name=sel_costarts size=20 class=formSelectColumnsLarge td width=60nbsp;/td td colspan=3img src=images/main_header.jpg width=371 height=148/td Have had the stripped off of the td and now look like this: td select name=sel_costarts size=20 class=formSelectColumnsLarge td width=60nbsp;/td td colspan=3img src=images/main_header.jpg width=371 height=148/td I need a regular expression that I can use in Homesite+ to locate all victims. I found a regex that I tried to hack and modify, but I only barely know regex. The hack has found a bunch, but I'd like more expert help if I could. This is the regex I used (which located all of the examples above). td[a-zA-Z0-9]* [^]* Can anyone help me do better? Thanks - Patti ~| 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. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Repost: Regular Expression Help
Thanks... it did. I'm going to bang on it for a while, and if the weekend doesn't go well, then I'll pop over to the regex list... -Patti On Friday, August 8, 2003, at 05:29 PM, Ben Doom wrote: Well, there are some things you can do here, but nothing's going to be perfect. Let me restate: it would be more work to create a regex to handle every case than to just to a find replace on things. Start with the most complicated common case. Let's say it's a td with a width. Your regex might look something like this: td width=([[:digit:]]+%?) and your replace would look like this: td width=\1 The problem is that there's no really good way for you to define how much the regex should match, since there are a really wide variety of things you can stick in a td, both legally and otherwise. Anyway, I'd start with your most complicated case and work back down to a plain td. From there, you ought to (hopefully) be able to tweak it by hand fairly easily. If not, or you want to explore this more thoroughly, or just want a better explanation of how the regex works or whatnot, I'd point you to the CF-RegEx list, where Ninjas are standing by. Seriously, there are several guys over there who, between us, generally can take on just about anything: http://www.houseoffusion.com/cf_lists/ index.cfm?method=threadsforumid=21 HTH. -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: Patricia G. L. Hall [mailto:[EMAIL PROTECTED] : Sent: Friday, August 08, 2003 8:41 AM : To: CF-Talk : Subject: Repost: Regular Expression Help : : : I tried to post this yesterday from the archives and I screwed it up. : So.. reposting. : : I am dealing with a site that has been ripped apart by search and : replace : in Homesite+. Tags that used to look like: : : td : select name=sel_costarts size=20 : class=formSelectColumnsLarge : : td width=60nbsp;/td : : td colspan=3img src=images/main_header.jpg width=371 : height=148/td : : Have had the stripped off of the td and now look like this: : : td : select name=sel_costarts size=20 : class=formSelectColumnsLarge : : td width=60nbsp;/td : : td colspan=3img src=images/main_header.jpg width=371 : height=148/td : : I need a regular expression that I can use in Homesite+ to locate all : victims. I found a regex that I tried to hack and modify, but I only : barely know regex. The hack has found a bunch, but I'd like more expert : help if I could. This is the regex I used (which located all of the : examples above). : : td[a-zA-Z0-9]* [^]* : : Can anyone help me do better? : : Thanks - Patti : : ~| 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: Repost: Regular Expression Help
Well, there are some things you can do here, but nothing's going to be perfect. Let me restate: it would be more work to create a regex to handle every case than to just to a find replace on things. Start with the most complicated common case. Let's say it's a td with a width. Your regex might look something like this: td width=([[:digit:]]+%?) and your replace would look like this: td width=\1 The problem is that there's no really good way for you to define how much the regex should match, since there are a really wide variety of things you can stick in a td, both legally and otherwise. Anyway, I'd start with your most complicated case and work back down to a plain td. From there, you ought to (hopefully) be able to tweak it by hand fairly easily. If not, or you want to explore this more thoroughly, or just want a better explanation of how the regex works or whatnot, I'd point you to the CF-RegEx list, where Ninjas are standing by. Seriously, there are several guys over there who, between us, generally can take on just about anything: http://www.houseoffusion.com/cf_lists/index.cfm?method=threadsforumid=21 HTH. -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: Patricia G. L. Hall [mailto:[EMAIL PROTECTED] : Sent: Friday, August 08, 2003 8:41 AM : To: CF-Talk : Subject: Repost: Regular Expression Help : : : I tried to post this yesterday from the archives and I screwed it up. : So.. reposting. : : I am dealing with a site that has been ripped apart by search and : replace : in Homesite+. Tags that used to look like: : : td : select name=sel_costarts size=20 : class=formSelectColumnsLarge : : td width=60nbsp;/td : : td colspan=3img src=images/main_header.jpg width=371 : height=148/td : : Have had the stripped off of the td and now look like this: : : td : select name=sel_costarts size=20 : class=formSelectColumnsLarge : : td width=60nbsp;/td : : td colspan=3img src=images/main_header.jpg width=371 : height=148/td : : I need a regular expression that I can use in Homesite+ to locate all : victims. I found a regex that I tried to hack and modify, but I only : barely know regex. The hack has found a bunch, but I'd like more expert : help if I could. This is the regex I used (which located all of the : examples above). : : td[a-zA-Z0-9]* [^]* : : Can anyone help me do better? : : Thanks - Patti : : ~| 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
Regular Expression Help
I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
ReReplaceNoCase(string,[[:punct:]],_,ALL) Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
Something like CFSET sNewString = REReplace(sOldString, [[:punct:][:space:]], , ALL) HTH -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 6, 2002 17:31 To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
It's as simple as: cfset str = reReplace(!@##\$%\^\*()-+={[}]|\\:;',\.\?/,_,all) Notice I had to escape out the # and for CF and a few character that regex use like . and *. It's possible I may have missed one though. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:31 AM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
That was what I was looking for, I just had not found it yet. Thanks -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:42 AM To: CF-Talk Subject: RE: Regular Expression Help ReReplaceNoCase(string,[[:punct:]],_,ALL) Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
Jeff, definetly use Josh's code - just make sure that the chars you want match the [[:punct:]] char class - from the docs: Matches any punctuation character, that is, one of ! ' # S % ` ( ) * + , - . / : ; = ? @ [ / ] ^ _ { | } ~ === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
How do you not replace a non-existent space before and after the string? Everything else works great. Thanks -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
I think you accidentally doubled the pipes between the punct and space. It should be: [[:punct:]]|[[:space:]] Thanks, Doug -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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.
RE: Regular Expression Help
lastly, you could think backwards [^A-Za-z0-9] Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 9:47 AM To: CF-Talk Subject: RE: Regular Expression Help Jeff, definetly use Josh's code - just make sure that the chars you want match the [[:punct:]] char class - from the docs: Matches any punctuation character, that is, one of ! ' # S % ` ( ) * + , - . / : ; = ? @ [ / ] ^ _ { | } ~ === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
What is a non-existent space? How could a regex remove a character not there? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:53 AM To: CF-Talk Subject: RE: Regular Expression Help How do you not replace a non-existent space before and after the string? Everything else works great. Thanks -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX ~| 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
RE: Regular Expression Help
Yeah, that's probably the safest method - anything that's NOT a letter or number. Good call. Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Rob Rohan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:54 PM To: CF-Talk Subject: RE: Regular Expression Help lastly, you could think backwards [^A-Za-z0-9] Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 9:47 AM To: CF-Talk Subject: RE: Regular Expression Help Jeff, definetly use Josh's code - just make sure that the chars you want match the [[:punct:]] char class - from the docs: Matches any punctuation character, that is, one of ! ' # S % ` ( ) * + , - . / : ; = ? @ [ / ] ^ _ { | } ~ === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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.
RE: Regular Expression Help
When I use your before mention snippet, I am getting an underscore character tacked onto the beginning and ending of each word. There is no space or any other character their, but after executing the regex statement, I have underscores before and after. [[:punct:]]|[[:space:]] on 'some phrase' returns '_some_phrase_' instead of 'some_phrase' which is what I was looking for. Thanks -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:54 AM To: CF-Talk Subject: RE: Regular Expression Help What is a non-existent space? How could a regex remove a character not there? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:53 AM To: CF-Talk Subject: RE: Regular Expression Help How do you not replace a non-existent space before and after the string? Everything else works great. Thanks -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX ~| 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.
RE: Regular Expression Help
Yep, this is probably the safest bet and produces the expected result. Thanks -Original Message- From: Rob Rohan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:54 AM To: CF-Talk Subject: RE: Regular Expression Help lastly, you could think backwards [^A-Za-z0-9] Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 9:47 AM To: CF-Talk Subject: RE: Regular Expression Help Jeff, definetly use Josh's code - just make sure that the chars you want match the [[:punct:]] char class - from the docs: Matches any punctuation character, that is, one of ! ' # S % ` ( ) * + , - . / : ; = ? @ [ / ] ^ _ { | } ~ === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:31 PM To: CF-Talk Subject: Regular Expression Help I am trying to use a regular expression to change all possible special characters in a string to underscores because I am trying to use the string as a variable name. Regular expressions are not my specialty and I am running into problems using some characters in my reReplace function. Could somebody offer some suggestions on making this work? I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank space, all with the _ character. Thanks -- Jeff ~| 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
RE: Regular Expression Help
Did you TRIM the variable first? That may help ... Perhaps there's whitespace surrounding the text. Try: ReReplaceNoCase(trim(variable),[^A-Za-z0-9],_,ALL) Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 1:03 PM To: CF-Talk Subject: RE: Regular Expression Help When I use your before mention snippet, I am getting an underscore character tacked onto the beginning and ending of each word. There is no space or any other character their, but after executing the regex statement, I have underscores before and after. [[:punct:]]|[[:space:]] on 'some phrase' returns '_some_phrase_' instead of 'some_phrase' which is what I was looking for. Thanks -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:54 AM To: CF-Talk Subject: RE: Regular Expression Help What is a non-existent space? How could a regex remove a character not there? === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Email: [EMAIL PROTECTED] WWW : www.camdenfamily.com/morpheus Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:53 AM To: CF-Talk Subject: RE: Regular Expression Help How do you not replace a non-existent space before and after the string? Everything else works great. Thanks -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:43 AM To: CF-Talk Subject: RE: Regular Expression Help Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX ~| 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
RE: Regular Expression Help
reReplace(string, [^A-Za-z0-9], _, ALL) on 'some phrase' returns 'some_phrase' as expected. reReplace(string, [[:punct:]]|[[:space:]], _ ALL) on 'some phrase' returns '_some_phrase_' which was not expected. The string 'some phrase' really is just that without any extra spaces. Either way, the first method works just fine and is probably safer. -Original Message- From: Joshua Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:30 PM To: CF-Talk Subject: RE: Regular Expression Help Did you TRIM the variable first? That may help ... Perhaps there's whitespace surrounding the text. Try: ReReplaceNoCase(trim(variable),[^A-Za-z0-9],_,ALL) Joshua Miller Head Programmer / IT Manager Garrison Enterprises Inc. www.garrisonenterprises.net [EMAIL PROTECTED] (704) 569-9044 ext. 254 * Any views expressed in this message are those of the individual sender, except where the sender states them to be the views of Garrison Enterprises Inc. This e-mail is intended only for the individual or entity to which it is addressed and contains information that is private and confidential. If you are not the intended recipient you are hereby notified that any dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error please delete it immediately and advise us by return e-mail to [EMAIL PROTECTED] * ~| 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
RE: Regular Expression Help
I'd use [[:punct:] ] as the class if you only need to check spaces -- if you need vertical tabs, carriage returns, tabs, etc. use [[:punct:][:space:]] which should give you something like newstring = rereplace(string, [[:punct:][:space:]], _, all); Of course, it might be easier (as Rob suggested) to think about what characters you want to allow instead of disallow: newstring = rereplace(string, [^a-zA-Z0-9_], _, all); would only keep letters, numbers, and underscores. As always, the plug for the RegEx list: http://www.houseoffusion.com/cf_lists/index.cfm?method=threadsforumid=21 Read, Post to, or Join the list here for all your RegEx needs. :-) --Ben Doom Programmer General Lackey Moonbow Software : -Original Message- : From: Joshua Miller [mailto:[EMAIL PROTECTED]] : Sent: Friday, December 06, 2002 12:43 PM : To: CF-Talk : Subject: RE: Regular Expression Help : : : Oh, forgot the space use [[:punct:]]||[[:space:]] as the RegEX : : Joshua Miller : Head Programmer / IT Manager : Garrison Enterprises Inc. : www.garrisonenterprises.net : [EMAIL PROTECTED] : (704) 569-9044 ext. 254 : : : * : Any views expressed in this message are those of the individual sender, : except where the sender states them to be the views of : Garrison Enterprises Inc. : : This e-mail is intended only for the individual or entity to which it is : addressed and contains information that is private and confidential. If : you are not the intended recipient you are hereby notified that any : dissemination, distribution or copying is strictly prohibited. If you : have received this e-mail in error please delete it immediately and : advise us by return e-mail to [EMAIL PROTECTED] : : * : : : -Original Message- : From: Jeff D. Chastain [mailto:[EMAIL PROTECTED]] : Sent: Friday, December 06, 2002 12:31 PM : To: CF-Talk : Subject: Regular Expression Help : : : I am trying to use a regular expression to change all possible special : characters in a string to underscores because I am trying to use the : string as a variable name. : : Regular expressions are not my specialty and I am running into problems : using some characters in my reReplace function. : : Could somebody offer some suggestions on making this work? : : I am needing to replace !@#$%^*()-+={[}]|\:;',.?/ plus a blank : space, all with the _ character. : : Thanks : -- Jeff : : : ~| 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
regular expression help
Hello, I've got a form field in which I want to allow people to enter HTML tags (formatted stories for the web), but only a limited set of them such as heading, bold, and italic tags so that they don't mess up the overall formatting of the page. What I'd like to do is automatically strip out any other HTML tag (or JavaScript, CSS, DHTML, etc.) from the submission but leave the safe tags. I'm thinking that using a regular expression string to do this would be the way to go, however there is something to consider about that idea. The data ends up in an NTEXT field in the SQL database which is capable of storing a lot of data and I suspect people might be typing as much as a few pages of text into this field. So I'm worried that a regular expression might take too long to parse through all the entered text. Perhaps I'm missing something obvious here. Anyone have any suggestions? ---mark Mark Warrick ([EMAIL PROTECTED]) Founder, Fusioneers.com / CTO, ZapConnect.com Phone: 714-547-5386 / 714-667-0203 / Efax: 801-730-7289 http://www.warrick.net / http://www.fusioneers.com http://www.zapconnect.com ICQ: 125160 AIM: markwarric Yahoo: Serengeti __ 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
RE: regular expression help
Mark, I am fairly new to RegEx, but I can tell you we did this on our University's site when I was in college. We allowed the different departments to submit formatted text using an assortment of HTML tags that we specified. We used RegEx to do this, and did not notice a performace hit at all. For what that's worth... Mike -Original Message- From: Mark Warrick [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 3:50 PM To: CF-Talk Subject: regular expression help Hello, I've got a form field in which I want to allow people to enter HTML tags (formatted stories for the web), but only a limited set of them such as heading, bold, and italic tags so that they don't mess up the overall formatting of the page. What I'd like to do is automatically strip out any other HTML tag (or JavaScript, CSS, DHTML, etc.) from the submission but leave the safe tags. I'm thinking that using a regular expression string to do this would be the way to go, however there is something to consider about that idea. The data ends up in an NTEXT field in the SQL database which is capable of storing a lot of data and I suspect people might be typing as much as a few pages of text into this field. So I'm worried that a regular expression might take too long to parse through all the entered text. Perhaps I'm missing something obvious here. Anyone have any suggestions? ---mark Mark Warrick ([EMAIL PROTECTED]) Founder, Fusioneers.com / CTO, ZapConnect.com Phone: 714-547-5386 / 714-667-0203 / Efax: 801-730-7289 http://www.warrick.net / http://www.fusioneers.com http://www.zapconnect.com ICQ: 125160 AIM: markwarric Yahoo: Serengeti __ 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: regular expression help
If you have a limited range of accepted tags then the following will probably be your best bet. 1. find all of the tags you want to allow. 2. replace their brackets with some non-standard character (like a yen symbol). 3. remove all other tags that exist. 4. replace your yen with brackets again. Hello, I've got a form field in which I want to allow people to enter HTML tags (formatted stories for the web), but only a limited set of them such as heading, bold, and italic tags so that they don't mess up the overall formatting of the page. What I'd like to do is automatically strip out any other HTML tag (or JavaScript, CSS, DHTML, etc.) from the submission but leave the safe tags. I'm thinking that using a regular expression string to do this would be the way to go, however there is something to consider about that idea. The data ends up in an NTEXT field in the SQL database which is capable of storing a lot of data and I suspect people might be typing as much as a few pages of text into this field. So I'm worried that a regular expression might take too long to parse through all the entered text. Perhaps I'm missing something obvious here. Anyone have any suggestions? ---mark Mark Warrick ([EMAIL PROTECTED]) Founder, Fusioneers.com / CTO, ZapConnect.com Phone: 714-547-5386 / 714-667-0203 / Efax: 801-730-7289 http://www.warrick.net / http://www.fusioneers.com http://www.zapconnect.com ICQ: 125160 AIM: markwarric Yahoo: Serengeti __ 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: Regular Expression Help
lWordList = ArrayToList(myarray,|); REReplaceNoCase(mystring,([^[:alnum]])(#lWordList#)([^[:alnum]]),\1\3 ,ALL); This will replace the words defined in myarray by empty strings. -Original Message- From: James Sleeman [mailto:[EMAIL PROTECTED]] Sent: zaterdag 2 maart 2002 13:29 To: CF-Talk Subject: Re: Regular Expression Help On Sat, 2002-03-02 at 10:10, Jared Stark wrote: Hello all. I am trying to write a simple search engine, and would like to replace certain commonly used prepositions from the search string such as 'a','the','for', etc... I have an array of the prepositions that I would like to remove, however the problem I have is that it is removing them when they are subsets of other words, for example 'them' would become 'm' when removing 'the', 'bag' would become 'bg' when removing 'a', etc... I'm not an expert at regular expression, but I'm assuming it is possible to remove only those instances where the prepositions are stand-alone and not subsets of other words. Could someone render me some assistance? If you want to use regular expressions to do it, easiest way would be to use the character class for whitespace before and after your preposition. However don't underestimate the power of the CF list processing functions, think of your search term as a list seperated by whitespace and you can use any of the CF list functions. __ 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: Regular Expression Help
On Sat, 2002-03-02 at 10:10, Jared Stark wrote: Hello all I am trying to write a simple search engine, and would like to replace certain commonly used prepositions from the search string such as 'a','the','for', etc I have an array of the prepositions that I would like to remove, however the problem I have is that it is removing them when they are subsets of other words, for example 'them' would become 'm' when removing 'the', 'bag' would become 'bg' when removing 'a', etc I'm not an expert at regular expression, but I'm assuming it is possible to remove only those instances where the prepositions are stand-alone and not subsets of other words Could someone render me some assistance? If you want to use regular expressions to do it, easiest way would be to use the character class for whitespace before and after your preposition However don't underestimate the power of the CF list processing functions, think of your search term as a list seperated by whitespace and you can use any of the CF list functions __ 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://wwwpennyhostcom/redirectcfm?adcode=coldfusionc FAQ: http://wwwthenetprofitscouk/coldfusion/faq Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/ Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists
Re: Regular Expression Help
just do a udf and create your array and then check that the value of the words you are replacing (length). If they are less than 4 char then they should be removed. Hope that makes sense. Success is a journey, not a destination!! Doug Brown - Original Message - From: James Sleeman [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, March 02, 2002 4:28 AM Subject: Re: Regular Expression Help On Sat, 2002-03-02 at 10:10, Jared Stark wrote: Hello all. I am trying to write a simple search engine, and would like to replace certain commonly used prepositions from the search string such as 'a','the','for', etc... I have an array of the prepositions that I would like to remove, however the problem I have is that it is removing them when they are subsets of other words, for example 'them' would become 'm' when removing 'the', 'bag' would become 'bg' when removing 'a', etc... I'm not an expert at regular expression, but I'm assuming it is possible to remove only those instances where the prepositions are stand-alone and not subsets of other words. Could someone render me some assistance? If you want to use regular expressions to do it, easiest way would be to use the character class for whitespace before and after your preposition. However don't underestimate the power of the CF list processing functions, think of your search term as a list seperated by whitespace and you can use any of the CF list functions. __ 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
Regular Expression Help
Hello all I am trying to write a simple search engine, and would like to replace certain commonly used prepositions from the search string such as 'a','the','for', etc I have an array of the prepositions that I would like to remove, however the problem I have is that it is removing them when they are subsets of other words, for example 'them' would become 'm' when removing 'the', 'bag' would become 'bg' when removing 'a', etc I'm not an expert at regular expression, but I'm assuming it is possible to remove only those instances where the prepositions are stand-alone and not subsets of other words Could someone render me some assistance? Much thanks, Jared __ 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://wwwpennyhostcom/redirectcfm?adcode=coldfusionc FAQ: http://wwwthenetprofitscouk/coldfusion/faq Archives: http://wwwmail-archivecom/cf-talk@houseoffusioncom/ Unsubscribe: http://wwwhouseoffusioncom/indexcfm?sidebar=lists