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
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
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
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
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
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
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
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
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
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: 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]
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]
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]
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]
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
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
RE: Regular Expression Help
Going from limited memory of the subject here, but try something like this: [\w the|a|..] (the 'the|a|..' part would be your preposition list...) I think the \w means you are looking for whole words. Or it might be \W... Hope that helps some... Shawn Grover -Original Message- From: Jared Stark [mailto:[EMAIL PROTECTED]] Sent: Friday, March 01, 2002 2:11 PM To: CF-Talk Subject: 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://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
Or you could use ListReplace with as the delimiter -- as long as you force everything lower case first. - Original Message - From: Jared Stark [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, March 02, 2002 10:10 AM Subject: 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, howeve r 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 possibl e 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 __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression help
I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? I'm having problems finding ways of detecting/converting case using CF regexes too (doing tags to lowercase for XHTML markup). From what I've gathered, Perl regexes can do this but CF can't. Bah. There is a Perl-compatible regex parsing extension tag for CF Server at http://www.rixsoft.com/ColdFusion/CFX/PCRegEx/, but I've not bothered with this. I'm plodding along with loops and substring extraction fiddliness. Of course all I'm doing is LCase() to certain substrings. Shame there's no Capitalise() CF function. There is something similar at http://www.cflib.org/udf.cfm?ID=9, might be of use to you. You could LCase() the whole string, then run it through this UDF. Imagine you could stick a workaround in for hyphenated names too! Let me know if you find any regex solution for dealing with case like this... - Gyrus - [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net - PGP key available __ 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
try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ 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
That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression help
um, did you try it? it works for me. christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 2:43 PM To: CF-Talk Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression help
All refind does is find the starting position of a string. IE: CFSET test = REFind(^[A-Z][a-z]+, hello world) CFOUTPUT #test# /CFOUTPUT returns 0 I need it to change hello world to Hello World There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:43 AM Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ 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
ah. you said Make sure that it's capitalized correctly in your email. i wrote a detection script. christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 3:00 PM To: CF-Talk Subject: Re: Regular expression help All refind does is find the starting position of a string. IE: CFSET test = REFind(^[A-Z][a-z]+, hello world) CFOUTPUT #test# /CFOUTPUT returns 0 I need it to change hello world to Hello World There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:43 AM Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression help
check cflib.org for a UDF that will cap the first letter of every word in a stringI think Raymond Camden wrote it..but don't quote me on that ;-) Bryan Stevenson VP Director of E-Commerce Development Electric Edge Systems Group Inc. p. 250.920.8830 e. [EMAIL PROTECTED] - Macromedia Associate Partner www.macromedia.com - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 12:00 PM Subject: Re: Regular expression help All refind does is find the starting position of a string. IE: CFSET test = REFind(^[A-Z][a-z]+, hello world) CFOUTPUT #test# /CFOUTPUT returns 0 I need it to change hello world to Hello World There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:43 AM Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression help
Use the UDF: capFirstTitle() http://www.cflib.org/udf.cfm?ID=116 For your purpose, CF RegExp won't do it as well as what Ed Hodder implemented with his UDF. But, FYI, REFind() and REFindNoCase() can return subexpressions. Example: Variables.sttREFind = REFind([[:graph:]]+, Variables.strName, 1, true); If (Variables.sttREFind.pos[1] GT 0) { Variables.strFirstWord = Mid(Variables.strName, Variables.sttREFind.pos[1], Variables.sttREFind.len[1]); } else { // nothing found Variables.strFirstWord = ; } See how messy this can get? The UDF has a much more elegant solution, in my opinion. :) Of course, RegExp has its uses. In your case, it isn't the most optimal solution. James. -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 12:00 PM To: CF-Talk Subject: Re: Regular expression help All refind does is find the starting position of a string. IE: CFSET test = REFind(^[A-Z][a-z]+, hello world) CFOUTPUT #test# /CFOUTPUT returns 0 I need it to change hello world to Hello World There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:43 AM Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression help
Here's a UDF I may not be the most eloquent but it does work. I used it to do tile casing. why my string is title ;o) CFscript //Changes a String to Title case Function TitleCase(title){ title = trim(title); //Caps first letter of string and Lower cases rest //for standardization Leadchar = UCase(RemoveChars(title,2,len(title))); title = RemoveChars(title, 1, 1); title = LCase(title); title = Leadchar title; start = 1; //loops through string word by word to Cap first letter //uses space to tell when new word starts While (start LT len(title)){ place = REFindNoCase( , title ,start ); //place has to be less than length of string and //greater than 0 (no more words) if (place LT len(title) and place GT 0){ Frontpart = Removechars(title,place,len(title)); backpart = RemoveChars(title, 1,place); //if last part is one letter like a Middle initial if (len(backpart) gt 1){ nextchar = RemoveChars(backpart,2,len(backpart)); backpart = RemoveChars(backpart,1,1); nextchar = Ucase(nextchar); title = frontpartnextchar backpart; start = place +1; } else{ backpart = Ucase(backpart); title = frontpartbackpart; start = place +1; } } else{ start = len(title); } } return title; } __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression help
There was a /CFSCRIPT at the bottom, must have gotten cut off. -Original Message- From: Bruce, Rodney (Contractor) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:05 PM To: CF-Talk Subject: RE: Regular expression help Here's a UDF I may not be the most eloquent but it does work. I used it to do tile casing. why my string is title ;o) CFscript //Changes a String to Title case Function TitleCase(title){ title = trim(title); //Caps first letter of string and Lower cases rest //for standardization Leadchar = UCase(RemoveChars(title,2,len(title))); title = RemoveChars(title, 1, 1); title = LCase(title); title = Leadchar title; start = 1; //loops through string word by word to Cap first letter //uses space to tell when new word starts While (start LT len(title)){ place = REFindNoCase( , title ,start ); //place has to be less than length of string and //greater than 0 (no more words) if (place LT len(title) and place GT 0){ Frontpart= Removechars(title,place,len(title)); backpart = RemoveChars(title, 1,place); //if last part is one letter like a Middle initial if (len(backpart) gt 1){ nextchar= RemoveChars(backpart,2,len(backpart));backpart= RemoveChars(backpart,1,1); nextchar = Ucase(nextchar); title = frontpart nextchar backpart; start = place +1; } else{ backpart = Ucase(backpart); title = frontpart backpart; start = place +1; } } else{ start = len(title); } } return title; } __ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression help
Douglas Brown wrote: I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? It is pretty easy with normal functions (see http://www.cflib.org/) in CF. I don't think it is possible purely with regular expressions. But even if I could tell you I wouldn't because I prefer te be able spell my own name correctly ;) Jochem van Dieten __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression help
Thanks a hell of alot. That works perfect There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: James Ang [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:57 AM Subject: RE: Regular expression help Use the UDF: capFirstTitle() http://www.cflib.org/udf.cfm?ID=116 For your purpose, CF RegExp won't do it as well as what Ed Hodder implemented with his UDF. But, FYI, REFind() and REFindNoCase() can return subexpressions. Example: Variables.sttREFind = REFind([[:graph:]]+, Variables.strName, 1, true); If (Variables.sttREFind.pos[1] GT 0) { Variables.strFirstWord = Mid(Variables.strName, Variables.sttREFind.pos[1], Variables.sttREFind.len[1]); } else { // nothing found Variables.strFirstWord = ; } See how messy this can get? The UDF has a much more elegant solution, in my opinion. :) Of course, RegExp has its uses. In your case, it isn't the most optimal solution. James. -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 12:00 PM To: CF-Talk Subject: Re: Regular expression help All refind does is find the starting position of a string. IE: CFSET test = REFind(^[A-Z][a-z]+, hello world) CFOUTPUT #test# /CFOUTPUT returns 0 I need it to change hello world to Hello World There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Douglas Brown [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:43 AM Subject: Re: Regular expression help That definately will not do it. There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown - Original Message - From: Christopher Olive [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, January 16, 2002 11:20 AM Subject: RE: Regular expression help try CFIF REFind(^[A-Z][a-z]+, VARIABLENAME) it's capitalized! /CFIF christopher olive, cto, vp of web development cresco technologies, inc 410.825.0383 http://www.crescotech.com -Original Message- From: Douglas Brown [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 16, 2002 1:46 PM To: CF-Talk Subject: Regular expression help I have a field that will be populated with a first name and a last name, what I want to do is make sure that the first letter of the first last name is uppercase and that all others are lower case. Could someone help in a reg expression that will do this? There are two major products that come out of Berkeley: LSD and [Unix] BSD. We don't believe this to be a coincidence. Doug Brown __ Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation · $99/Month · Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regular expression help!
string = string.replace(/HEAD[^]*[.\n]*\/HEAD/gi,''); Pascal Peters Macromedia Certified Instructor Certified ColdFusion (5.0) Advanced Developer Certified Web Developer LR Technologies, Belgium Tel +32 2 639 68 70 Fax +32 2 639 68 99 Email [EMAIL PROTECTED] Web www.lrt.be -Original Message- From: gyrus [mailto:[EMAIL PROTECTED]] Sent: vrijdag 9 november 2001 0:32 To: CF-Talk Subject: regular expression help! The code I'm doing now is actually in JS, but I'm having a general CF/JS regular expression learning binge, and I've hit a brick wall - can anyone help?! Best example of the problem is this: string = string.replace(/HEAD[^]*[^(\/HEAD)]*\/HEAD/gi,''); I want this to strip any HEAD tags - and *anything* in between them. The middle bit is the problem - how do I match zero or more characters up to the point where you find /HEAD? Putting /HEAD in parentheses and negating it with a carat seems to only work if there are no characters between in tags that appear in /HEAD. So HEAD12345678/HEAD will be stripped out fine, but HEAD1234567d/HEAD gets left in. I know I must be just missing one control character, or have one in the wrong spot, but no reference material I've got seems to point it out. Anyone got any hints? cheers, - Gyrus ~~ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: regular expression help!
You could just find the first head, store the position, find the next head, store the position, and then just use mid(string,pos+6,pos-1) to strip the middle out maybe there is a more efficient way Brook At 11:32 PM 08/11/01 +, you wrote: The code I'm doing now is actually in JS, but I'm having a general CF/JS regular expression learning binge, and I've hit a brick wall - can anyone help?! Best example of the problem is this: string = string.replace(/HEAD[^]*[^(\/HEAD)]*\/HEAD/gi,''); I want this to strip any HEAD tags - and *anything* in between them. The middle bit is the problem - how do I match zero or more characters up to the point where you find /HEAD? Putting /HEAD in parentheses and negating it with a carat seems to only work if there are no characters between in tags that appear in /HEAD. So HEAD12345678/HEAD will be stripped out fine, but HEAD1234567d/HEAD gets left in. I know I must be just missing one control character, or have one in the wrong spot, but no reference material I've got seems to point it out. Anyone got any hints? cheers, - Gyrus ~~ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: regular expression help!
Try using cfset string=rereplace(string,(head)[[:print:]]*(/head),,all) That should find anything with a beginning of head and an ending of /head and strip them out and any printable character in between with an empty string. I'm not sitting at a coldfusion enabled server, so I can't verify, but it should be that, or very close to it. Stuart Duncan. At 11:32 PM 08/11/2001 +, you wrote: The code I'm doing now is actually in JS, but I'm having a general CF/JS regular expression learning binge, and I've hit a brick wall - can anyone help?! Best example of the problem is this: string = string.replace(/HEAD[^]*[^(\/HEAD)]*\/HEAD/gi,''); I want this to strip any HEAD tags - and *anything* in between them. The middle bit is the problem - how do I match zero or more characters up to the point where you find /HEAD? Putting /HEAD in parentheses and negating it with a carat seems to only work if there are no characters between in tags that appear in /HEAD. So HEAD12345678/HEAD will be stripped out fine, but HEAD1234567d/HEAD gets left in. I know I must be just missing one control character, or have one in the wrong spot, but no reference material I've got seems to point it out. Anyone got any hints? cheers, - Gyrus ~~ 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
Dain, thank you very much. Is it safe to assume then that anything else i want to search for can be added by placing the definition inside another pair of brackets? Yeah, square brackets define a class to match against, and clasess are or'ed together. [^ ] would match everything that wasnt a space too. ~~ 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
John, Your assumption is correct. The part that may have confused you originally is that POSIX-style character classes (ie, [:punct:]) are surrounded by brackets and colons, in addition to the bracket set that defines the entire character class, such as [[:alpha:][:punct:][:cntrl:]] etc... Numeric charcter classes are special in that you can use a hyphen for any range of numbers, such as [0-9], [0-3], [3-7], etc. which emcompass every number in that specific range. Dain Anderson Caretaker, CF Comet http://www.cfcomet.com/ - Original Message - From: John Barleycorn [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, July 27, 2001 1:39 AM Subject: Re: Regular Expression Help Dain, thank you very much. Is it safe to assume then that anything else i want to search for can be added by placing the definition inside another pair of brackets? REFindNoCase([[:Alpha:][0-3][ ][:Punct:]], myString) (added [0-3] and [ ] to find a space) thanks. From: Dain Anderson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: Re: Regular Expression Help Date: Thu, 26 Jul 2001 21:02:45 -0400 John, You almost had it (too many brackets): cfif REFindNoCase([[:Alpha:][:Punct:]], myString) Alpha characters or punctuation were found. cfelse No alpha characters or punctuation found. /cfif If you need to get the position of the first occurance of these characters, use subexpressions: cfset mystring = 1234.ABCD !--- Use the 'returnsubexpressions' parameter to get the position --- cfset something = REFindNoCase([[:Alpha:][:Punct:]], myString, 1, True) cfif something.pos[1] cfoutput Characters found at position: #something.pos[1]#BR /cfoutput cfelse No alpha characters or punctuation found. /cfif Dain Anderson Caretaker, CF Comet http://www.cfcomet.com/ - Original Message - From: John Barleycorn [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 6:42 PM Subject: Regular Expression Help Hello, i'm having some trouble using regular expressions. i read the book and looked up examples, but unfortunately, i can't seem to solve my problem. i've written code that checks to see if there is either a letter or a punctuation mark in a string, but it's not returning results properly. here's the code: cfset something = REFindNoCase('[[:Alpha:]][[:Punct:]]', myString) and my return value is always zero. can anyone tell me how this should be written so that i works? thanks for your help. oh, forgot one thing, i also need to check to see if there are any spaces inside the string. that's something i also don't know how to do. thanks a lot. ~~ 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
Being a Perl programmer also, this is one of the things that really frustrates me about CF's regular expressions. Okay, so back in the day, Allaire decided to go with POSIX-style character classes. That still doesn't explain to me why you have to put the extra square brackets in there, and it doesn't explain why I can't write: [:digit:]{3}-?[:digit:]{4} to describe a US-style telephone number without an area code. I work with three different software packages that all support regular expressions, but there's nothing regular about them. They all use different notations, they all have quirks, and I still have to look it up in order to remember which regular expression I'm using. Maybe I'm missing something, but I haven't been able to take my knowledge of regexp that I learned from Perl and apply it to CF with any semblance of consistency. |--+--| |Eric A. Laney |Happiness:| |Systems Engineer |An agreeable sensation arising from contemplating the | |LAN Optimization |misery of another.| |Team | | |Voice:| | |813.978.4404 | | |Pager:| | |888.985.8519 | | |--+--| Dain Anderson To: CF-Talk [EMAIL PROTECTED] DainAnderson@cc: nc.rr.comSubject: Re: Regular Expression Help 07/27/2001 08:28 AM Please respond to cf-talk John, Your assumption is correct. The part that may have confused you originally is that POSIX-style character classes (ie, [:punct:]) are surrounded by brackets and colons, in addition to the bracket set that defines the entire character class, such as [[:alpha:][:punct:][:cntrl:]] etc... Numeric charcter classes are special in that you can use a hyphen for any range of numbers, such as [0-9], [0-3], [3-7], etc. which emcompass every number in that specific range. Dain Anderson Caretaker, CF Comet http://www.cfcomet.com/ - Original Message - From: John Barleycorn [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Friday, July 27, 2001 1:39 AM Subject: Re: Regular Expression Help Dain, thank you very much. Is it safe to assume then that anything else i want to search for can be added by placing the definition inside another pair of brackets? REFindNoCase([[:Alpha:][0-3][ ][:Punct:]], myString) (added [0-3] and [ ] to find a space) thanks. From: Dain Anderson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: Re: Regular Expression Help Date: Thu, 26 Jul 2001 21:02:45 -0400 John, You almost had it (too many brackets): cfif REFindNoCase([[:Alpha:][:Punct:]], myString) Alpha characters or punctuation were found. cfelse No alpha characters or punctuation found. /cfif If you need to get the position of the first occurance of these characters, use subexpressions: cfset mystring = 1234.ABCD !--- Use the 'returnsubexpressions' parameter to get the position --- cfset something = REFindNoCase([[:Alpha:][:Punct:]], myString, 1, True) cfif something.pos[1] cfoutput Characters found at position: #something.pos[1]#BR /cfoutput cfelse No alpha characters or punctuation found. /cfif Dain Anderson Caretaker, CF Comet http
Re: Regular Expression Help
I find that: [0-9] is clearer and easier to type than: [:digit:] of course, I'd rather have: \d I do very well without ever using the posix-style. Dick At 8:56 AM -0400 7/27/01, [EMAIL PROTECTED] wrote: Being a Perl programmer also, this is one of the things that really frustrates me about CF's regular expressions. Okay, so back in the day, Allaire decided to go with POSIX-style character classes. That still doesn't explain to me why you have to put the extra square brackets in there, and it doesn't explain why I can't write: [:digit:]{3}-?[:digit:]{4} to describe a US-style telephone number without an area code. I work with three different software packages that all support regular expressions, but there's nothing regular about them. They all use different notations, they all have quirks, and I still have to look it up in order to remember which regular expression I'm using. Maybe I'm missing something, but I haven't been able to take my knowledge of regexp that I learned from Perl and apply it to CF with any semblance of consistency. |--+--| |Eric A. Laney |Happiness:| ~~ 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
John, You almost had it (too many brackets): cfif REFindNoCase([[:Alpha:][:Punct:]], myString) Alpha characters or punctuation were found. cfelse No alpha characters or punctuation found. /cfif If you need to get the position of the first occurance of these characters, use subexpressions: cfset mystring = 1234.ABCD !--- Use the 'returnsubexpressions' parameter to get the position --- cfset something = REFindNoCase([[:Alpha:][:Punct:]], myString, 1, True) cfif something.pos[1] cfoutput Characters found at position: #something.pos[1]#BR /cfoutput cfelse No alpha characters or punctuation found. /cfif Dain Anderson Caretaker, CF Comet http://www.cfcomet.com/ - Original Message - From: John Barleycorn [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 6:42 PM Subject: Regular Expression Help Hello, i'm having some trouble using regular expressions. i read the book and looked up examples, but unfortunately, i can't seem to solve my problem. i've written code that checks to see if there is either a letter or a punctuation mark in a string, but it's not returning results properly. here's the code: cfset something = REFindNoCase('[[:Alpha:]][[:Punct:]]', myString) and my return value is always zero. can anyone tell me how this should be written so that i works? thanks for your help. oh, forgot one thing, i also need to check to see if there are any spaces inside the string. that's something i also don't know how to do. thanks a lot. ~~ 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
Dain, thank you very much. Is it safe to assume then that anything else i want to search for can be added by placing the definition inside another pair of brackets? REFindNoCase([[:Alpha:][0-3][ ][:Punct:]], myString) (added [0-3] and [ ] to find a space) thanks. From: Dain Anderson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: Re: Regular Expression Help Date: Thu, 26 Jul 2001 21:02:45 -0400 John, You almost had it (too many brackets): cfif REFindNoCase([[:Alpha:][:Punct:]], myString) Alpha characters or punctuation were found. cfelse No alpha characters or punctuation found. /cfif If you need to get the position of the first occurance of these characters, use subexpressions: cfset mystring = 1234.ABCD !--- Use the 'returnsubexpressions' parameter to get the position --- cfset something = REFindNoCase([[:Alpha:][:Punct:]], myString, 1, True) cfif something.pos[1] cfoutput Characters found at position: #something.pos[1]#BR /cfoutput cfelse No alpha characters or punctuation found. /cfif Dain Anderson Caretaker, CF Comet http://www.cfcomet.com/ - Original Message - From: John Barleycorn [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 6:42 PM Subject: Regular Expression Help Hello, i'm having some trouble using regular expressions. i read the book and looked up examples, but unfortunately, i can't seem to solve my problem. i've written code that checks to see if there is either a letter or a punctuation mark in a string, but it's not returning results properly. here's the code: cfset something = REFindNoCase('[[:Alpha:]][[:Punct:]]', myString) and my return value is always zero. can anyone tell me how this should be written so that i works? thanks for your help. oh, forgot one thing, i also need to check to see if there are any spaces inside the string. that's something i also don't know how to do. thanks a lot. ~~ 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
OT: are there any statistics on how many developers regexp has made bald? ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular expression Help
Re: use of regular expressions for parsing html One can reliably use regular expressions to parse html if it is html that you have direct and full editorial control over. That is, if you hand edit the html, AND you can keep all your requirements in mind, then you can use with some success regular expressions to parse html. Otherwise, if you are trying to parse pages from the net, you can be pretty certain to run into serious stumbling blocks (ie the perverse things people and applications do in the name of writing or generating html). For instance, if I knew that the meta tag would _always_ be the format you described, I use a regular expression like content="([^"]*)" and know that the stuff between the parens would be what I wanted. However, I see html all the time that adds newlines arbitrarily at white space... which means that you have to somehow make certain that you know where to stop parsing... -- Larry W. Virden URL: mailto:[EMAIL PROTECTED] URL: http://www.purl.org/net/lvirden/ Even if explicitly stated to the contrary, nothing in this posting should be construed as representing my employer's opinions. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression Help
This works. CFSET theString = "meta name=""pubdate"" content=""Fri, 23 Mar 2001 07:00:00 GMT""" CFSET st = reFindNoCase("(content="")(.*)(GMT"")",theString,1,"TRUE") CFOUTPUT#mid(theString,st.pos[3],st.len[3])#/CFOUTPUT The two pieces are: 1) Creating the regularExpression 2) understanding the use of the "return subexpressions" attribute of reFind; check the documentation. I learned something just now about using it with a paren-ed regular expression. -Original Message- From: Mallory Woods [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 10:17 AM To: CF-Talk Subject: Regular expression Help Greetings All, I am in the process of developing a small headache with Regular Expressions... I have looked at all of the examples I could find on the archives of this mailing list and other web pages but I still just don't get it.. I think I will pickup the O'Reilly book that I have seen at another job before on regular expressions but for now I am asking the list for help.. What I am trying to do is parse through an HTML source page an look for a specfic string.. for example.. meta name="pubdate" content="Fri, 23 Mar 2001 07:00:00 GMT" I would like to grab everything from this string from " to GMT" Thanks in Advance... Mallory Woods This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email and any such files in error and that any use, dissemination, forwarding, printing or copying of this email and/or any such files is strictly prohibited. If you have received this email in error please immediately notify [EMAIL PROTECTED] and destroy the original message and any such files. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression Help
Mallory, Try this: cfset newVar=REFind(varWithHTML,'meta name="pubdate"[^]+') That should return the string; meta name="pubdate" content="[some date]" Which you can then extract the date from. Good luck! Douglas Malcolm -Original Message- From: Mallory Woods [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 8:17 AM To: CF-Talk Subject: Regular expression Help Greetings All, I am in the process of developing a small headache with Regular Expressions... I have looked at all of the examples I could find on the archives of this mailing list and other web pages but I still just don't get it.. I think I will pickup the O'Reilly book that I have seen at another job before on regular expressions but for now I am asking the list for help.. What I am trying to do is parse through an HTML source page an look for a specfic string.. for example.. meta name="pubdate" content="Fri, 23 Mar 2001 07:00:00 GMT" I would like to grab everything from this string from " to GMT" Thanks in Advance... Mallory Woods This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email and any such files in error and that any use, dissemination, forwarding, printing or copying of this email and/or any such files is strictly prohibited. If you have received this email in error please immediately notify [EMAIL PROTECTED] and destroy the original message and any such files. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression Help
This should work if you want the GMT included: REFINDNOCASE("meta name=""pubdate"" content=""([a-zA-Z0-9,: ]+[^"])""", YourStringNameGoesHere) This should work if you don't want GMT: REFINDNOCASE("meta name=""pubdate"" content=""([a-zA-Z0-9,: ]+[^GMT"])""", YourStringNameGoesHere) Remember CF RE's are aggressive. Keep a leash on em ;) Hope this helps. Scott Cavanaugh Software Developer Online Operations Salem Communications Corporation -Original Message- From: Mallory Woods [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 8:17 AM To: CF-Talk Subject: Regular expression Help Greetings All, I am in the process of developing a small headache with Regular Expressions... I have looked at all of the examples I could find on the archives of this mailing list and other web pages but I still just don't get it.. I think I will pickup the O'Reilly book that I have seen at another job before on regular expressions but for now I am asking the list for help.. What I am trying to do is parse through an HTML source page an look for a specfic string.. for example.. meta name="pubdate" content="Fri, 23 Mar 2001 07:00:00 GMT" I would like to grab everything from this string from " to GMT" Thanks in Advance... Mallory Woods This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email and any such files in error and that any use, dissemination, forwarding, printing or copying of this email and/or any such files is strictly prohibited. If you have received this email in error please immediately notify [EMAIL PROTECTED] and destroy the original message and any such files. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Regular expression help
Leaves table tags in: cfset VariableWithTags=#REReplaceNoCase(VariableWithTags,'table([[:alpha:]]|[[:s pace:]]|[[:punct:]])+/table','table/table')# Removes table tags: cfset VariableWithTags=#REReplaceNoCase(VariableWithTags,'table([[:alpha:]]|[[:s pace:]]|[[:punct:]])+/table','')# Note that the default attribute for scope is "one", so the above snippet will only remove the first instance it finds of table tags. Change the scope to "all" if you want them all gone. Of course, if you only want one very specific table tag set to be removed, you'll have to find it another way (adding some other unique text for the regexp to look for). Douglas Malcolm -Original Message- From: Jeff Britts [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 11:50 AM To: CF-Talk Subject: Regular expression help Help for a regular expression idiot. I'm looking to remove all the characters between two tags: example from: table asldfj lskdf jaskldf jklasdf jlaskdfj lasdkf /table to: table/table (removing the tags themselves would be a plus) ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regular Expression Help?
On Fri, 23 Feb 2001 10:33:10 +1300, in cf-talk you wrote: Firstly I'd like to mention that doing this is playing with fire. ;) Yeah, of course it is ;) Secondly, I'd suggest three replaces: 1. Replace application.cfm with an easily recognisable other string without application in the name. 2. Replace "([^a-zA-Z0-9])application.([a-zA-z])" with "\1request.\2". 3. Replace the funny string with application.cfm again. Yeah, that's a good idea. I'll use ([^a-zA-Z0-9])application.([a-zA-z]) instead, though, since "application." is often the end of the sentence in the text of the website, and it's sometimes followed by a tag. I'm still curious about the regex, though, since I'm trying to learn regexes. Although I will use the above method for now, I would like to ask any experts on the subject if they could slap a single regex together for me. It doesn't need to replace anything, but I'm very curious about the matching regex--how do you exclude a certain string ("cfm"), a space (" "), AND a "" from matching (see my original question below). If you care to refer to the book, "Mastering Regular Expressions," I have it. Thanks for indulging me, Jamie David Cummins Jamie Jackson wrote: Hi, I'm trying to globally replace (with CF Studio) application variables with request variables in several sites. I can't figure out exactly how, as I don't know how to negate strings (as opposed to just character classes). I want to change application.variableX to request.variableX, but I don't want to change "application. ", "application.br", or references to "application.cfm" Could you please help? Here is just one of may seriously flawed attempts at a match: (application\.)([^ ]|[^cC][^fF][^mM]|[^]) Thanks, Jamie Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists