Re: Regex question
On Wed, Jul 17, 2013 at 11:15 AM, Matthew Allen wrote: Is it possible to change the reference-link tag from a reference link tag reference-link id=1 type=reference/ to a superscript as so sup1/sup, basically getting the value of the id attribute of the reference link tag and creating a superscript tag with the value. I'll let someone else help with regex, but my comment from the peanut gallery: This smells like something you may be able to easily do using jQuery and let the client side manage this. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| 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:356216 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: RegEx Question
Not only can you do it with jQuery, you /should/ do it with jQuery (or equiv). Regex is not built for HTML parsing, and there are many reasons why it wont work correctly when you try. Rather than worry about numerous edge cases, use a tool designed for the job from the start. ~| 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:344746 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: RegEx Question
Thanks that's brilliant! -Original Message- From: Dominic Watson [mailto:watson.domi...@googlemail.com] Sent: Wednesday, May 18, 2011 5:42 AM To: cf-talk Subject: Re: RegEx Question Here is a very blunt regex that should match the opening tag (does not check for the lack of target=_blank: a.*?href=.*?\.pdf.*? Here's a great site: http://gskinner.com/RegExr/ On 18 May 2011 02:30, Lists li...@commadelimited.com wrote: You could actually do this with jquery quite easily should you want to do it client side. $('a[href*=pdf]').click(function(){ window.open($(this).href); }) On May 17, 2011, at 5:35 PM, Duane Boudreau du...@sandybay.com wrote: Hi All, First time posting in a very long time. I'm stuck on a RegEx problem that I can't wrap my head around. I need to have a block of html and I need to add target=_blank to any hyperlink that has a pdf link in it. Any suggestions? Here is the match string I tried so far but I don't think I'm even close. a\\s[^]*href=['\\\]( (?i:)(?:jpg|gif|doc|pdf)$*) If anyone can point me in the right direction it would be much appreciated. TIA, Duane ~| 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:344675 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: RegEx Question
Here is a very blunt regex that should match the opening tag (does not check for the lack of target=_blank: a.*?href=.*?\.pdf.*? Here's a great site: http://gskinner.com/RegExr/ On 18 May 2011 02:30, Lists li...@commadelimited.com wrote: You could actually do this with jquery quite easily should you want to do it client side. $('a[href*=pdf]').click(function(){ window.open($(this).href); }) On May 17, 2011, at 5:35 PM, Duane Boudreau du...@sandybay.com wrote: Hi All, First time posting in a very long time. I'm stuck on a RegEx problem that I can't wrap my head around. I need to have a block of html and I need to add target=_blank to any hyperlink that has a pdf link in it. Any suggestions? Here is the match string I tried so far but I don't think I'm even close. a\\s[^]*href=['\\\]( (?i:)(?:jpg|gif|doc|pdf)$*) If anyone can point me in the right direction it would be much appreciated. TIA, Duane ~| 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:344611 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: RegEx Question
You could actually do this with jquery quite easily should you want to do it client side. $('a[href*=pdf]').click(function(){ window.open($(this).href); }) On May 17, 2011, at 5:35 PM, Duane Boudreau du...@sandybay.com wrote: Hi All, First time posting in a very long time. I'm stuck on a RegEx problem that I can't wrap my head around. I need to have a block of html and I need to add target=_blank to any hyperlink that has a pdf link in it. Any suggestions? Here is the match string I tried so far but I don't think I'm even close. a\\s[^]*href=['\\\]( (?i:)(?:jpg|gif|doc|pdf)$*) If anyone can point me in the right direction it would be much appreciated. TIA, Duane ~| 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:344609 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex Question
Could be as simple as \w{3} Would that do it (searching for 3 consecutive word characters)? -- Charlie Griefer http://charlie.griefer.com I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. On Thursday, April 28, 2011 at 10:10 AM, Rick Colman wrote: input looks like: (A XXX)(B YYY)(C ZZZ) I need to pull out: XXXYYYZZZ ... Can somebody help? TNX. Rick. ~| 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:344026 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Regex Question
Perhaps using list functions? cfset myList =(A XXX)(B YYY)(C ZZZ) cfset loop1 = listlen(mylist,)) cfset myresult = cfoutput cfloop from=1 to=#loop1# index=A cfset loopStr1 = listgetat(myList, A, )) cfset myResult = #myresult##right(loopStr1, 3)# /cfloop /cfoutput -Original Message- From: Rick Colman [mailto:rcol...@cox.net] Sent: 28 April 2011 18:10 To: cf-talk Subject: Regex Question input looks like: (A XXX)(B YYY)(C ZZZ) I need to pull out: XXXYYYZZZ ... Can somebody help? TNX. Rick. ~| 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:344027 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex Question
That seems like it might do the trick: http://regexr.com?2tl99 Could be as simple as \w{3} Would that do it (searching for 3 consecutive word characters)? -- Charlie Griefer http://charlie.griefer.com I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. On Thursday, April 28, 2011 at 10:10 AM, Rick Colman wrote: input looks like: (A XXX)(B YYY)(C ZZZ) I need to pull out: XXXYYYZZZ ... Can somebody help? TNX. Rick. ~| 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:344030 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex Question
would it ignore the parens and space? will try shortly. TNX! On 4/28/2011 1:17 PM, Andy Matthews wrote: That seems like it might do the trick: http://regexr.com?2tl99 Could be as simple as \w{3} Would that do it (searching for 3 consecutive word characters)? -- Charlie Griefer http://charlie.griefer.com I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. On Thursday, April 28, 2011 at 10:10 AM, Rick Colman wrote: input looks like: (A XXX)(B YYY)(C ZZZ) I need to pull out: XXXYYYZZZ ... Can somebody help? TNX. Rick. ~| 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:344032 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex Question
Robert, How about treating CGI.path_info as a list, using / as your delimiter. Then you can use the various list* functions in CF to parse it however you want. Carl On 12/3/2010 9:26 AM, Robert Harrison wrote: Regex is not my strong suit, but someone may know this off the top of their head. If I have a long url like: http://www.mysite.com/item1/option2/part3/section4 I can use cgi.path_info to get the /item1/option2/part3/section4 part of the string. Now is there an easy regex that could let me get the item1 option2 part3 section4 parts of the string easily? I'd assume there could just be one regex statement where you could just change the number(s) to get data from first / to second /; data from second / to third /, etc. Any ideas? Thanks Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be. Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| 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:339757 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex Question
Agreed. /item1/option2/part3/section4 cfoutput item = #listFirst(cgi.path_info, /)# br / option = #listGetAt(cgi.path_info, 2, /)# br / part = #listGetAt(cgi.path_info, 3, /)# br / section = #listLast(cgi.path_info, /)# /cfoutput From: Carl Von Stetten vonner.li...@vonner.net Sent: Friday, December 03, 2010 12:36 PM To: cf-talk cf-talk@houseoffusion.com Subject: Re: Regex Question Robert, How about treating CGI.path_info as a list, using / as your delimiter. Then you can use the various list* functions in CF to parse it however you want. Carl On 12/3/2010 9:26 AM, Robert Harrison wrote: Regex is not my strong suit, but someone may know this off the top of their head. If I have a long url like: http://www.mysite.com/item1/option2/part3/section4 I can use cgi.path_info to get the /item1/option2/part3/section4 part of the string. Now is there an easy regex that could let me get the item1 option2 part3 section4 parts of the string easily? I'd assume there could just be one regex statement where you could just change the number(s) to get data from first / to second /; data from second / to third /, etc. Any ideas? Thanks Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be. Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| 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:339760 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Regex Question
listGetAt(cgi.path_info, 2, /) Great. That will work for what I want. I want to be able to pass the cgi.path_info to a CFC and pass a digit so the CFC could extract the part of the string I want to do a query... I'm using long URLs to pass variables more and more these days, as opposed to ?bin=1item=2part=3. Thanks Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| 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:339761 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Regex Question
Yep, that'll work. Of course, listGetAt(cgi.path_info, 1, /) is the same as listFirst(cgi.path_info, /), so just passing the integer is a nice solution: returnVar = listGetAt(arguments.path_info, arguments.index, /); From: Robert Harrison rob...@austin-williams.com Sent: Friday, December 03, 2010 1:03 PM To: cf-talk cf-talk@houseoffusion.com Subject: RE: Regex Question listGetAt(cgi.path_info, 2, /) Great. That will work for what I want. I want to be able to pass the cgi.path_info to a CFC and pass a digit so the CFC could extract the part of the string I want to do a query... I'm using long URLs to pass variables more and more these days, as opposed to ?bin=1item=2part=3. Thanks Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| 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:339762 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex question
On 8/19/2010 8:32 AM, Ian Skinner wrote: I need to turn some relative links into absolute links in a string. I have this rereplace() working well to do that. rereplace(links,'(href=)([^]*)','\1http://www.cdpr.ca.gov\2','ALL') Thank you Ian, adding the forward slash[/] character in two places solved this nicely! rereplace(links,'(href=)/([^]*)','\1http://www.cdpr.ca.gov/\2','ALL') ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336417 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Regex question
I, for one, am having trouble understanding what you're trying to accomplish. I could probably help you if I understood the purpose/goal of your regular expression. Assuming that you have this content loaded into a variable, you're not reading a line at a time from a file, and you're wanting to find new lines and leading white-space I'd search like this (also matches white-space at the beginning and end of the file and at the end of a line): ((^|\s*[\r\n]+)\s|\s+$) Disclaimer: I haven't tested the regex, but it should work as advertised. On Thu, Jul 17, 2008 at 11:18 AM, Will Tomlinson [EMAIL PROTECTED] wrote: Let's say I've got a chunk of source code like so: form name=frmLogin action=index.cfm?action=tomlinson.setTestForm method=post table width=45% align=left border=0 cellpadding=5 cellspacing=1 class=subHeader tr valign=middle bgcolor=ff td width=20% align=rightUsername/td td width=20% align=leftinput class=req type=text name=usrID size=20 value=#variables.frmData.usrID# //td /tr etc... So it can have almost any kind of character in it. Now, let's say I want to check the beginning for whatever, in this case, I want a match if it has a newline or carriage return at the beginning. (?i)^[\r\s]+[.\r\s\S]* With this regex i'm trying to say, look for the newline/tab/c.return at the start of the text, and allow ANYthing afterwards. I don't care what comes after, allow it. My problem is understanding the \S (non whitespace) in the 2nd []. If I remove it, I don't have a match. if I include it,I DO have a match. What is in that chunk of text that isn't being matched, that .\r\s won't match. What's the best way to say look, I don't care what comes AFTER this specific piece of the regex that matches. Allow EVERYthing. Make sense? Thanks, Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309239 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regex question
I, for one, am having trouble understanding what you're trying to accomplish. I could probably help you if I understood the purpose/goal of your regular expression. Sonny, thanks for the help! I could't make that regex work for my particular problem. Probably because I didn't explain it well enough. It looks like it's matching if there's any spacing before characters on any line. I need to check a chunk of text and make sure it contains SOME kinda characters on the first line. There cannot be any empty spacing on the first line (c.returns,linefeeds, spaces, tabs, etc. The rest of the chunk can contain whatever, I don't care. My regex works, I just don't understand why I have to stick a \S in that 2nd range []. Thanks! Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309249 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regex question
If I understand correctly, this should do what you want: ^\s+ On Thu, Jul 17, 2008 at 2:56 PM, Will Tomlinson [EMAIL PROTECTED] wrote: I, for one, am having trouble understanding what you're trying to accomplish. I could probably help you if I understood the purpose/goal of your regular expression. Sonny, thanks for the help! I could't make that regex work for my particular problem. Probably because I didn't explain it well enough. It looks like it's matching if there's any spacing before characters on any line. I need to check a chunk of text and make sure it contains SOME kinda characters on the first line. There cannot be any empty spacing on the first line (c.returns,linefeeds, spaces, tabs, etc. The rest of the chunk can contain whatever, I don't care. My regex works, I just don't understand why I have to stick a \S in that 2nd range []. Thanks! Will ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309255 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regex question in rereplace
You can certainly do it with a regex, but it might be more efficient to do it with a pair or replace() calls. Regex is inherently expensive. If you want to do it with regex, Jacob's suggestion should work. --Ben Doom Scott Stewart wrote: Ive got a variable which is a document descriptor (literally, journal, book etc.) in some cases it can contain a slash (/) or a semicolon. What I need to do within the REReplace is find every instance of a slash or a semicolon and put a space before it and a space after it.. Thanks sas Scott Stewart ColdFusion Developer HYPERLINK http://maps.yahoo.com/py/maps.py?Pyt=Tmapaddr=7241+Jillspring+Ctcsz=Sprin gfield%2C+VA.+22152country=us \n7241 Jillspring Ct Springfield, VA. 22152 HYPERLINK mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] HYPERLINK http://www.sstwebworks.com; \nhttp://www.sstwebworks.com tel: mobile: HYPERLINK http://www.plaxo.com/click_to_call?src=jj_signatureTo=703-912-3076Email=s [EMAIL PROTECTED] \n703-912-3076 HYPERLINK http://www.plaxo.com/click_to_call?src=jj_signatureTo=703-220-2835Email=s [EMAIL PROTECTED] \n703-220-2835 HYPERLINK https://www.plaxo.com/add_me?u=25770055805src=client_sig_212_1_card_joini nvite=1 \nAlways have my latest info HYPERLINK http://www.plaxo.com/signature?src=client_sig_212_1_card_sig; \nWant a signature like this? ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274091 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regex question in rereplace
This should work: reReplace(myVar,([;/]), \1 ,all) It uses a technique called back references, which allows you to use the strings that match the regex in your replacement string (that's what the \1 is). On 3/28/07, Scott Stewart [EMAIL PROTECTED] wrote: I've got a variable which is a document descriptor (literally, journal, book etc.) in some cases it can contain a slash (/) or a semicolon. What I need to do within the REReplace is find every instance of a slash or a semicolon and put a space before it and a space after it.. ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274048 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regex question.
Why wouldn't you just loop over the cfexecute's return using crlf as the delim and a simple find(20,currentline) statement in the loop? If true treat the currentline as a space delimned list and trim(ListFirst(currentline, )). Maybe not as elegant, but at least you can read it. Mik That is exactly what I did to prove the concept, but I will almost always take a one line solution over a five line solution. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| 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:271364 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regex question.
By importing it as a column-width datasource. :-) However, if that's not an option, you could use a regex like this: (^|#linebreak#).+?20.+?(#linebreak#|$) To identify lines which match your criterion. #linebreak# should contain whatever linebreak character(s) were used, obviously. Use refind to return all pos/loc pairs, and use mid() to pull the actual line. Not tested, YMMV, etc. --Ben Doom Ian Skinner wrote: How would one of you regex skilled people find the name on the line that has a 20 in it, there maybe more then one line like this. Name Type Status - ISKINNER-SVR 00 UNIQUE Registered SMFNT 00 GROUP Registered ISKINNER-SVR 20 UNIQUE Registered ISKINNER-SVR 03 UNIQUE Registered SMFNT 1E GROUP Registered INet~Services 1C GROUP Registered IS~ISKINNER-SVR00 UNIQUE Registered ISKINNER 03 UNIQUE Registered ISKINNER-SVR 01 UNIQUE Registered -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 Flex 2. Free Trial http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271202 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regex question.
By importing it as a column-width datasource. :-) Unfortunately not, since this the output from a cfexecute ... command. Not tested, YMMV, etc. Thanks, I will give it a try, looks good and should replace the 5 line looping structure I currently have. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271208 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regex question.
Not convinced this is the best way, but it works: cfset Result = REReplace(Data,'(\n([^]*?)([^2][0-9A-F]+|2[^0][0-9A-F]*|20[0-9A-F]+)[^\n]*)+',',','all')/ cfset Result = ListToArray(REReplace(Result,'\s*,\s*([^\s]*)[^,]*',',\1','all'))/ (First REReplace isolates any 20 lines, second one cuts out non-name data and converts to array) How would one of you regex skilled people find the name on the line that has a 20 in it, there maybe more then one line like this. Name Type Status - ISKINNER-SVR 00 UNIQUE Registered SMFNT 00 GROUP Registered ISKINNER-SVR 20 UNIQUE Registered ISKINNER-SVR 03 UNIQUE Registered SMFNT 1E GROUP Registered INet~Services 1C GROUP Registered IS~ISKINNER-SVR00 UNIQUE Registered ISKINNER 03 UNIQUE Registered ISKINNER-SVR 01 UNIQUE Registered -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| 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:271216 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regex question.
Why wouldn't you just loop over the cfexecute's return using crlf as the delim and a simple find(20,currentline) statement in the loop? If true treat the currentline as a space delimned list and trim(ListFirst(currentline, )). Maybe not as elegant, but at least you can read it. Mik At 05:02 PM 3/1/2007, Peter Boughton wrote: Not convinced this is the best way, but it works: cfset Result = REReplace(Data,'(\n([^]*?)([^2][0-9A-F]+|2[^0][0-9A-F]*|20[0-9A-F]+)[^\n]*)+',',','all')/ cfset Result = ListToArray(REReplace(Result,'\s*,\s*([^\s]*)[^,]*',',\1','all'))/ (First REReplace isolates any 20 lines, second one cuts out non-name data and converts to array) How would one of you regex skilled people find the name on the line that has a 20 in it, there maybe more then one line like this. Name Type Status - ISKINNER-SVR 00 UNIQUE Registered SMFNT 00 GROUP Registered ISKINNER-SVR 20 UNIQUE Registered ISKINNER-SVR 03 UNIQUE Registered SMFNT 1E GROUP Registered INet~Services 1C GROUP Registered IS~ISKINNER-SVR00 UNIQUE Registered ISKINNER 03 UNIQUE Registered ISKINNER-SVR 01 UNIQUE Registered -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| 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:271219 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regex question.
*shrug* Almost did give a solution similar to that, but then decided to go for a regex one since that's what was specifically asked for. But reconsidering, I agree - I should've gone for the more readable one... cfset Names = ArrayNew(1)/ cfloop index=thisRow list=#Data# delimiters=#Chr(10)# cfif Find('20',thisRow) cfset ArrayAppend(Names, ListFirst(thisRow,' '))/ /cfif /cfloop cfdump eval=Names/ Why wouldn't you just loop over the cfexecute's return using crlf as the delim and a simple find(20,currentline) statement in the loop? If true treat the currentline as a space delimned list and trim(ListFirst(currentline, )). Maybe not as elegant, but at least you can read it. Mik At 05:02 PM 3/1/2007, Peter Boughton wrote: Not convinced this is the best way, but it works: cfset Result = REReplace(Data, '(\n([^]*?)([^2][0-9A-F]+|2[^0][0-9A-F]*|20[0-9A-F]+)[^\n]*)+',',', 'all')/ cfset Result = ListToArray(REReplace(Result,'\s*,\s*([^\s]*)[^,]*', ',\1','all'))/ (First REReplace isolates any 20 lines, second one cuts out non-name data and converts to array) How would one of you regex skilled people find the name on the line that has a 20 in it, there maybe more then one line like this. Name Type Status - ISKINNER-SVR 00 UNIQUE Registered SMFNT 00 GROUP Registered ISKINNER-SVR 20 UNIQUE Registered ISKINNER-SVR 03 UNIQUE Registered SMFNT 1E GROUP Registered INet~Services 1C GROUP Registered IS~ISKINNER-SVR00 UNIQUE Registered ISKINNER 03 UNIQUE Registered ISKINNER-SVR 01 UNIQUE Registered -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271222 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regex question.
oops, that arrayappend is wrong. Should be: cfset ArrayAppend(Names,ListFirst(thisRow,' '))/ (since not all rows have a space between the name and [num] bit. *shrug* Almost did give a solution similar to that, but then decided to go for a regex one since that's what was specifically asked for. But reconsidering, I agree - I should've gone for the more readable one... cfset Names = ArrayNew(1)/ cfloop index=thisRow list=#Data# delimiters=#Chr(10)# cfif Find('20',thisRow) cfset ArrayAppend(Names, ListFirst(thisRow,' '))/ /cfif /cfloop cfdump eval=Names/ Why wouldn't you just loop over the cfexecute's return using crlf as the delim and a simple find(20,currentline) statement in the loop? If true treat the currentline as a space delimned list and trim(ListFirst(currentline, )). Maybe not as elegant, but at least you can read it. Mik At 05:02 PM 3/1/2007, Peter Boughton wrote: Not convinced this is the best way, but it works: cfset Result = REReplace(Data, '(\n([^]*?)([^2][0-9A-F]+|2[^0][0-9A-F]*|20[0-9A-F]+)[^\n]*)+',', ', 'all')/ cfset Result = ListToArray(REReplace(Result,'\s*,\s*([^\s]*)[^, ]*', ',\1','all'))/ (First REReplace isolates any 20 lines, second one cuts out non-name data and converts to array) How would one of you regex skilled people find the name on the line that has a 20 in it, there maybe more then one line like this. Name Type Status - ISKINNER-SVR 00 UNIQUE Registered SMFNT 00 GROUP Registered ISKINNER-SVR 20 UNIQUE Registered ISKINNER-SVR 03 UNIQUE Registered SMFNT 1E GROUP Registered INet~Services 1C GROUP Registered IS~ISKINNER-SVR00 UNIQUE Registered ISKINNER 03 UNIQUE Registered ISKINNER-SVR 01 UNIQUE Registered -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Sudoku | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| 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:271224 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: RegEx Question
I'm trying to create a regular expression that will work to find all strings that are within a [ ] block (square bracket area) For this kind of job, CF_Reextract is the best tool: See http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm?p=hf You can even test it online on your test samples: http://www.contentbox.com/claude/customtags/REextract/testingREextract.cfm -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| 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:217855 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: RegEx Question
Ok - I think I found it \[[^]]*\] I dind't need to escape the ] in the Inner NOT Clause I guess Kevin -Original Message- From: Claude Schneegans [mailto:[EMAIL PROTECTED] Sent: Friday, September 09, 2005 3:36 PM To: CF-Talk Subject: Re: RegEx Question I'm trying to create a regular expression that will work to find all strings that are within a [ ] block (square bracket area) For this kind of job, CF_Reextract is the best tool: See http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm?p=hf You can even test it online on your test samples: http://www.contentbox.com/claude/customtags/REextract/testingREextract.cfm -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:217856 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: RegEx question: Multiple replaces in one statement
Nope, but you don't REreplace at all, a simple replace will do the trick just as well, and with less overhead. You could even use replaceList, but I'd not recommend that, as it has some weird quirks. cheers, barneyb On 7/29/05, B G [EMAIL PROTECTED] wrote: Is it possible to replace two different items in a string? I have a table holding brand names. All ~ should be (r) AND all ^ should be TM. Currently I am doing the following: cfset nBrand = #REReplace(qGetBrandNames.Brand_Names, ~, (r), ALL)# cfset nBrand = #REReplace(nBrand, \^, ##8482;, ALL)# Is it possible to do this in one REReplace statement? Thanks. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213278 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: RegEx question: Multiple replaces in one statement
Here's how I would do it: cfset nBrand = Replace(Replace(qGetBrandNames.Brand_Names,~,(r),ALL),^,##8482;,ALL) You're still calling replace twice, but it's only one line of code. And Barney's right...don't use REReplace if you don't need it, it's extra overhead. Dave ---Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 12:05 PM To: CF-Talk Subject: Re: RegEx question: Multiple replaces in one statement Nope, but you don't REreplace at all, a simple replace will do the trick just as well, and with less overhead. You could even use replaceList, but I'd not recommend that, as it has some weird quirks. cheers, barneyb On 7/29/05, B G [EMAIL PROTECTED] wrote: Is it possible to replace two different items in a string? I have a table holding brand names. All ~ should be (r) AND all ^ should be TM. Currently I am doing the following: cfset nBrand = #REReplace(qGetBrandNames.Brand_Names, ~, (r), ALL)# cfset nBrand = #REReplace(nBrand, \^, ##8482;, ALL)# Is it possible to do this in one REReplace statement? Thanks. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213280 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: RegEx question: Multiple replaces in one statement
Thanks! I actually did have the one line with REReplace but a well hidden syntax error got me to separate the two. For my own education, what is REReplace doing that Replace is not which adds the overhead? From: [EMAIL PROTECTED] Reply-To: cf-talk@houseoffusion.com To: CF-Talk cf-talk@houseoffusion.com Subject: RE: RegEx question: Multiple replaces in one statement Date: Fri, 29 Jul 2005 11:19:07 -0500 Here's how I would do it: cfset nBrand = Replace(Replace(qGetBrandNames.Brand_Names,~,(r),ALL),^,##8482;,ALL) You're still calling replace twice, but it's only one line of code. And Barney's right...don't use REReplace if you don't need it, it's extra overhead. Dave ---Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 12:05 PM To: CF-Talk Subject: Re: RegEx question: Multiple replaces in one statement Nope, but you don't REreplace at all, a simple replace will do the trick just as well, and with less overhead. You could even use replaceList, but I'd not recommend that, as it has some weird quirks. cheers, barneyb On 7/29/05, B G [EMAIL PROTECTED] wrote: Is it possible to replace two different items in a string? I have a table holding brand names. All ~ should be (r) AND all ^ should be TM. Currently I am doing the following: cfset nBrand = #REReplace(qGetBrandNames.Brand_Names, ~, (r), ALL)# cfset nBrand = #REReplace(nBrand, \^, ##8482;, ALL)# Is it possible to do this in one REReplace statement? Thanks. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213294 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: RegEx question: Multiple replaces in one statement
Replace just does a straight string literal matching, REReplace dose regex, which requires a little more processing to go with the increased power of matching patterns not just string literals.. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning -Original Message- From: B G [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 11:35 AM To: CF-Talk Subject: RE: RegEx question: Multiple replaces in one statement Thanks! I actually did have the one line with REReplace but a well hidden syntax error got me to separate the two. For my own education, what is REReplace doing that Replace is not which adds the overhead? From: [EMAIL PROTECTED] Reply-To: cf-talk@houseoffusion.com To: CF-Talk cf-talk@houseoffusion.com Subject: RE: RegEx question: Multiple replaces in one statement Date: Fri, 29 Jul 2005 11:19:07 -0500 Here's how I would do it: cfset nBrand = Replace(Replace(qGetBrandNames.Brand_Names,~,(r),ALL),^,##8482 ;,ALL) You're still calling replace twice, but it's only one line of code. And Barney's right...don't use REReplace if you don't need it, it's extra overhead. Dave ---Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 12:05 PM To: CF-Talk Subject: Re: RegEx question: Multiple replaces in one statement Nope, but you don't REreplace at all, a simple replace will do the trick just as well, and with less overhead. You could even use replaceList, but I'd not recommend that, as it has some weird quirks. cheers, barneyb On 7/29/05, B G [EMAIL PROTECTED] wrote: Is it possible to replace two different items in a string? I have a table holding brand names. All ~ should be (r) AND all ^ should be TM. Currently I am doing the following: cfset nBrand = #REReplace(qGetBrandNames.Brand_Names, ~, (r), ALL)# cfset nBrand = #REReplace(nBrand, \^, ##8482;, ALL)# Is it possible to do this in one REReplace statement? Thanks. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| 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:213295 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regex Question
S.Isaac pointed out that I'd misread the original post. I thought he wanted to remove them, not replace them. That makes this just a wee bit harder. :-) Since what he's wanting to do is apparently average them, I'd write the summation loop manually and track the last non-zero value to use in case of zeros. I'm not sure what he'd want to do with a leading zero, but that's a whole new bag'o'worms. --Ben Michael Dinowitz wrote: Ben, I've tried this a few ways and I can't find any way to do a single run RegEx which will do the job. Handling a single 0 is child's play. Handling multiple properly is not happening. If this was put in a loop, I can see it but. What do you suggest as a solution that will handle multiple 0 replaces without a loop? Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:194967 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regex Question
Tony, if someone entered a 0, wouldnt you want to account for that? Or if you didnt.. why not delete the 0's and then get an average (if they're just place holders)? If a 0 is just a place holder, you wouldnt want to replace it with a previous value. That would mess up your average. On Wed, 16 Feb 2005 10:32:28 -0500, Ben Doom [EMAIL PROTECTED] wrote: S.Isaac pointed out that I'd misread the original post. I thought he wanted to remove them, not replace them. That makes this just a wee bit harder. :-) Since what he's wanting to do is apparently average them, I'd write the summation loop manually and track the last non-zero value to use in case of zeros. I'm not sure what he'd want to do with a leading zero, but that's a whole new bag'o'worms. --Ben Michael Dinowitz wrote: Ben, I've tried this a few ways and I can't find any way to do a single run RegEx which will do the job. Handling a single 0 is child's play. Handling multiple properly is not happening. If this was put in a loop, I can see it but. What do you suggest as a solution that will handle multiple 0 replaces without a loop? Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:194974 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regex Question
Actually, it wouldn't.. The way an average is to be calculated here is to add up the balance for each day of the month and divide by number of days in the month. It was easy to deposit the balance on days that had deposits, it got harder on days that didn't have deposits.. I did end up using a cfloop.. I had a few regexes in mind, but they didn't work well. On Wed, 16 Feb 2005 09:51:54 -0600, Greg Morphis [EMAIL PROTECTED] wrote: Tony, if someone entered a 0, wouldnt you want to account for that? Or if you didnt.. why not delete the 0's and then get an average (if they're just place holders)? If a 0 is just a place holder, you wouldnt want to replace it with a previous value. That would mess up your average. On Wed, 16 Feb 2005 10:32:28 -0500, Ben Doom [EMAIL PROTECTED] wrote: S.Isaac pointed out that I'd misread the original post. I thought he wanted to remove them, not replace them. That makes this just a wee bit harder. :-) Since what he's wanting to do is apparently average them, I'd write the summation loop manually and track the last non-zero value to use in case of zeros. I'm not sure what he'd want to do with a leading zero, but that's a whole new bag'o'worms. --Ben Michael Dinowitz wrote: Ben, I've tried this a few ways and I can't find any way to do a single run RegEx which will do the job. Handling a single 0 is child's play. Handling multiple properly is not happening. If this was put in a loop, I can see it but. What do you suggest as a solution that will handle multiple 0 replaces without a loop? Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:195049 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regex Question
Actually, it wouldn't.. The way an average is to be calculated here is to add up the balance for each day of the month and divide by number of days in the month. It was easy to deposit the balance on days that had deposits, it got harder on days that didn't have deposits.. I did end up using a cfloop.. I had a few regexes in mind, but they didn't work well. On Wed, 16 Feb 2005 09:51:54 -0600, Greg Morphis [EMAIL PROTECTED] wrote: Tony, if someone entered a 0, wouldnt you want to account for that? Or if you didnt.. why not delete the 0's and then get an average (if they're just place holders)? If a 0 is just a place holder, you wouldnt want to replace it with a previous value. That would mess up your average. On Wed, 16 Feb 2005 10:32:28 -0500, Ben Doom [EMAIL PROTECTED] wrote: S.Isaac pointed out that I'd misread the original post. I thought he wanted to remove them, not replace them. That makes this just a wee bit harder. :-) Since what he's wanting to do is apparently average them, I'd write the summation loop manually and track the last non-zero value to use in case of zeros. I'm not sure what he'd want to do with a leading zero, but that's a whole new bag'o'worms. --Ben Michael Dinowitz wrote: Ben, I've tried this a few ways and I can't find any way to do a single run RegEx which will do the job. Handling a single 0 is child's play. Handling multiple properly is not happening. If this was put in a loop, I can see it but. What do you suggest as a solution that will handle multiple 0 replaces without a loop? Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:195072 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: Regex Question
Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:194850 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: Regex Question
Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 try this as a starting place: while (listfindnocase(mylist,0)) { rereplacenocase(mylist,([0-9]+),0(,|$),\1,\1\2,ALL); } I don't think there's a good way to do this with a single-pass... I could be wrong. :) s. isaac dealey 954.927.5117 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/story/?storyid=44477DE=1 http://www.sys-con.com/story/?storyid=45569DE=1 http://www.fusiontap.com ~| 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:194851 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regex Question
I don't think listdeleteat() would produce what he wants actually -- 'cause he's wanting to replace those list items, not remove them. If I read it correctly. Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony s. isaac dealey 954.927.5117 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/story/?storyid=44477DE=1 http://www.sys-con.com/story/?storyid=45569DE=1 http://www.fusiontap.com ~| 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:194863 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Regex Question
Ben, I've tried this a few ways and I can't find any way to do a single run RegEx which will do the job. Handling a single 0 is child's play. Handling multiple properly is not happening. If this was put in a loop, I can see it but. What do you suggest as a solution that will handle multiple 0 replaces without a loop? Well, you could use listdeleteat() to remove them. That would probably be more human readable later. It would also handle boundary cases (ie the first and last items) easily and cleanly. If, for some reason, you really want to use a regex, it certainly can be done. :-) --Ben Tony Hicks wrote: Does anyone know if there's a way to replace an unkown number of consequitive 0s in a list with the previous number.. For instance... 147,0,119,137,0,0,0,154 would become.. 147,147,119,137,137,137,137,154 Thanks Tony ~| 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:194872 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: Regex Question
Thanks for the input.. Yeah.. I need to average these... What these are is day-end balances.. and basically, so its easy to do if there was a transaction that day.. if there wasn't, it gets harder, because that returns a 0. I know of a few different loops that would get the job done, but the idea is of course.. to loop as little as possible. ~| 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:194883 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: regex question
It all depends what you want to do with the XXX. If you want to use it as is, you can use backreferencing: REReplaceNoCase(CONTENT,FOO:(.*?),'a href=lookup.cfm?word=\1\1/a',ALL) Where \1 will match XXX. If you need to transform it, you will need a loop: cfscript start = 1; while(true){ stTmp = REFindNoCase(FOO:(.*?),content,start,true); if(stTmp.pos[1] IS 0) break; value = Mid(content,stTmp.pos[2],stTmp.len[2]); content = RemoveChars(content,stTmp.pos[1],stTmp.len[1]); newvalue = getSnippet(value); content = Insert(newvalue,content,stTmp.pos[1] - 1); start = stTmp.pos[1] + Len(newvalue); } /cfscript I just wrote this code without testing, so it may need some tweaking. Pascal -Original Message- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: 22 December 2004 13:52 To: CF-Talk Subject: regex question (I posted this once, and it didn't bounce but I didn't see it come through to the list...) Question about regex (this never happens here, does it!) I want to match FOO:XXX where XXX could be any length of characters (but most likely a uuid) And I want to know the matched string when I'm done... Ie, some variable set to XXX, whatever XXX is. How do it do that? Ultimately, I'd like to pass the matched result to a function and do a replace... ie, something like this: REReplaceNoCase(CONTENT,FOO:.*?,getSnippet(XXX),ALL) - rIck ~| 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:188522 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: RegEx Question
Not directly.However, you could use refind() to find the string.I don't remember what the syntax is off the top of my head, but you can get the length and position of each matching string.You could then replace it using repeatstring(). I had to do what you appear to want to do, and that's how I tackled it. Suggestions for iprovements are certainly welcome, as I think it's a shade inelegant. --Ben Adam Haskell wrote: is it possible to find out how long a matching string is in rereplace? Something like: rereplace(string_with_spaces,[ ]{2,},nbsp;{number of times},all) Basically just trying to replace a character with something else as many times as it happens...but its gotta happen atleast twice. I've got working code using loops just looking for another solution for kicks. Adam H [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
Duane Boudreau wrote: Sample content block: There are 31 [GT:moons] that surround Saturn I need to replace [GT:moons] with a href=""> I've got the following regex ,\[GT:([a-zA-Z0-9 \'\\/]*)\], but the problem is that I really need to check for any character between [GT: and ]. \[GT:([^\]]+)\] Jochem [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
On CFMX, this is the cleanest to read: \[GT:(.*?)\] On CF5, you'll have to use: \[GT:([^]])\] Not tested, may need tweaking, YMMV, etc. --Ben Duane Boudreau wrote: Hi All, Got a regex question. Sample content block: There are 31 [GT:moons] that surround Saturn I need to replace [GT:moons] with a href=""> I've got the following regex ,\[GT:([a-zA-Z0-9 \'\\/]*)\], but the problem is that I really need to check for any character between [GT: and ]. I know it should be something like \[GT:(.*)\] but I cant figure out how to enter in the exception for ] TIA, Duane [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regex Question
Both Jochem and Ben were very close, here's what worked: \[GT:([^]]*)\] All I had to do was add the * Thanks Guys! Duane _ From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Friday, September 24, 2004 10:29 AM To: CF-Talk Subject: Re: Regex Question On CFMX, this is the cleanest to read: \[GT:(.*?)\] On CF5, you'll have to use: \[GT:([^]])\] Not tested, may need tweaking, YMMV, etc. --Ben Duane Boudreau wrote: Hi All, Got a regex question. Sample content block: There are 31 [GT:moons] that surround Saturn I need to replace [GT:moons] with a href=""> I've got the following regex ,\[GT:([a-zA-Z0-9 \'\\/]*)\], but the problem is that I really need to check for any character between [GT: and ]. I know it should be something like \[GT:(.*)\] but I cant figure out how to enter in the exception for ] TIA, Duane _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
Oops.Heh.Well, that's why I put the disclaimer at the bottom.:-) --Ben Duane Boudreau wrote: Both Jochem and Ben were very close, here's what worked: \[GT:([^]]*)\] All I had to do was add the * Thanks Guys! Duane _ From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Friday, September 24, 2004 10:29 AM To: CF-Talk Subject: Re: Regex Question On CFMX, this is the cleanest to read: \[GT:(.*?)\] On CF5, you'll have to use: \[GT:([^]])\] Not tested, may need tweaking, YMMV, etc. --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
WIthout sounding silly. Isn't this more of a simple replace rather than using RegEx? replace(string, '[GT:moons]', 'a href=""> ', 'all') Just a thought Andy On Fri, 24 Sep 2004 10:18:53 -0400, Duane Boudreau [EMAIL PROTECTED] wrote: Hi All, Got a regex question. Sample content block: There are 31 [GT:moons] that surround Saturn I need to replace [GT:moons] with a href=""> I've got the following regex ,\[GT:([a-zA-Z0-9 \'\\/]*)\], but the problem is that I really need to check for any character between [GT: and ]. I know it should be something like \[GT:(.*)\] but I cant figure out how to enter in the exception for ] TIA, Duane [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
Andy Jarrett wrote: WIthout sounding silly. Isn't this more of a simple replace rather than using RegEx? A replace is actually more difficult since you would probably want to preserve case. Jochem [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: [Spam?] Re: Regex Question
I suspect that he wants to replace all glossary terms, not just moons: REReplace(string,'\[GT:([^]]+)\]','a href=""> Pascal -Original Message- From: Andy Jarrett [mailto:[EMAIL PROTECTED] Sent: 24 September 2004 17:28 To: CF-Talk Subject: [Spam?] Re: Regex Question WIthout sounding silly. Isn't this more of a simple replace rather than using RegEx? replace(string, '[GT:moons]', 'a href=""> ', 'all') Just a thought Andy On Fri, 24 Sep 2004 10:18:53 -0400, Duane Boudreau [EMAIL PROTECTED] wrote: Hi All, Got a regex question. Sample content block: There are 31 [GT:moons] that surround Saturn I need to replace [GT:moons] with a href=""> [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question
I need to replace [GT:moons] with a href=""> This is a typical job for CF_REextract. See http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm?p=hf -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regex Question: All punct except...
One solution I've used before in vaguely similar situations is to replace the / character with a placeholder, do the nice clean reg ex, then put the slashes back: myString = replace( myString, /, PLACEHOLDER, ALL ); myString = REReplace( myString, [[:punct:]], , ALL ); myString = Replace( myString, PLACEHOLDER, / ); but : - it's going to be slower than doing it all in one regex - you have to choose a placeholder that's never going to appear in your input string (I use something like donkeyshiftingpignudger, or other such blather) - it feels like a nasty kludge so I only use it when I have to (i.e. when I just don't have time to get the all-in-one reg ex working) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question: All punct except...
Alistair Davidson wrote: One solution I've used before in vaguely similar situations is to replace the / character with a placeholder, do the nice clean reg ex, then put the slashes back: but : - you have to choose a placeholder that's never going to appear in your input string (I use something like donkeyshiftingpignudger, or other such blather) I ususally use the bell character (chr(7)) because it's not typable and doesn't show up in any of the predifined classes (IIRC). --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question: All punct except...
I can't think of a clean way to use the punct class. However, I will state that writing out the chars you *do* want to replace in a class is going to run faster than what you have.On the other hand, it's annoying to write.:-) --Ben Patricia Lee wrote: I want a CF regex to replace all punctuation except for the / character. I made it work with the following: [^/[:alpha:][:digit:][:space:]] But I was wondering if there was a simpler way to write it with the [:punct:] class? [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regex Question: All punct except...
Thanks for the repy and for the advice.Not my strong suit, regex is. -P I can't think of a clean way to use the punct class. However, I will state that writing out the chars you *do* want to replace in a class is going to run faster than what you have.On the other hand, it's annoying to write.:-) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: RegEx Question...
Assuming you are requiring the 1- and the area code: 1-[0-9]{3}-[0-9]{3}-[0-9]{4} Something more flexible might be ((1-)?[0-9]{3}-)?[0-9]{3}-[0-9]{4} HTH. --Ben Doom Che Vilnonis wrote: Real simple questionfolks...I use something like this to flag invalid zipcodes: cfscript if (NOT (REFind('^[[:digit:]]{5}(( |-)?[[:digit:]]{4})?$',FORM.ZIP) NEQ 0)) {} /cfscript What RegEx would work to validate a US phone number in a 1-888-555-1212 format? Thank again...Che [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: RegEx Question...
Thanks Ben. -Original Message- From: Ben Doom [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 2:42 PM To: CF-Talk Subject: Re: RegEx Question... Assuming you are requiring the 1- and the area code: 1-[0-9]{3}-[0-9]{3}-[0-9]{4} Something more flexible might be ((1-)?[0-9]{3}-)?[0-9]{3}-[0-9]{4} HTH. --Ben Doom Che Vilnonis wrote: Real simple questionfolks...I use something like this to flag invalid zipcodes: cfscript if (NOT (REFind('^[[:digit:]]{5}(( |-)?[[:digit:]]{4})?$',FORM.ZIP) NEQ 0)) {} /cfscript What RegEx would work to validate a US phone number in a 1-888-555-1212 format? Thank again...Che [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: RegEx Question
Hi First off, remove the leading '^.* and trailing .*$; they aren't necessary in this case and just get in the way Also, you need to backquote the literal ()'s to distinguish them from ()'s that are part of the regex. Also, you could use the [[:digit:]] thing instead of [0-9], but you don't need too. Without testing it, this will be closer... CFSET foo = REReplaceNoCase(foo,'A class=jargon href=javascript:popUpJargonDefinition\(([0-9]*)\)([^]*)/a',\1) Also, I'm not sure if REReplaceNoCase is going to do exactly what you want... you might consider using REFindNoCase with returnsubexpressions set to true. This will give you the position of the first match and you can manually do a string extraction and replace from that. It all depends on what you want the end result to look like. Mark -Original Message- From: Oliver Cookson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 8:41 AM To: CF-Talk Subject: OT: RegEx Question Hi, In a nutshell I need to find all instances of the below link (see below) in a article. The article could be 2 lines long or 2000 lines long and the again the there could be 2 links or 2000 links. This is an example of the link I need to look for and replace: A class=jargon href=javascript:popUpJargonDefinition(136)katie/A NOTE: The ID (in this case 136) will change and the label (in this case katie) will also change, everything else will be the same. This is how far I got but it doesn't work and im really scratching my head: CFSET foo = REReplaceNoCase(foo,'^.*A class=jargon href=javascript:popUpJargonDefinition([0-9]*)([^]*)/a.*$',\1) (sorry for the word wrap) Any help would be greatly appreciated! Thanks ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegEx Question
OK. It's implied, but I'm assuming you want these to stop being links, am I right? If so, you need to do something more like the following: foo = REReplaceNoCase(foo,'a class=jargon href=javascript:popUpJargonDefinition\([0-9]*\)([^]*)/a',\1, all); Note that I've removed the ^.* and the .*$ because these will cause the regex to match all of foo if it contains a matching link. I've also escaped the parens in the javascript call, so they are seen as parens in the text instead of a grouping operator. I also added all to the replacenocase call, so it will replace all instances. Should you require more assistance, feel free to go to the regex list either online via the archives or by subscribing: http://www.houseoffusion.com/cf_lists/index.cfm?method=threadsforumid=21 For all your regex needs. Ninjas are standing by. -- Ben Doom Programmer General Lackey Moonbow Software, Inc : -Original Message- : From: Oliver Cookson [mailto:[EMAIL PROTECTED] : Sent: Wednesday, July 02, 2003 8:41 AM : To: CF-Talk : Subject: OT: RegEx Question : : : Hi, : : In a nutshell I need to find all instances of the below link (see below) : in a article. The article could be 2 lines long or 2000 lines long and : the again the there could be 2 links or 2000 links. : : This is an example of the link I need to look for and replace: : : A class=jargon href=javascript:popUpJargonDefinition(136)katie/A : : NOTE: The ID (in this case 136) will change and the label (in this : case katie) will also change, everything else will be the same. : : : This is how far I got but it doesn't work and im really scratching my : head: : : CFSET foo = REReplaceNoCase(foo,'^.*A class=jargon : href=javascript:popUpJargonDefinition([0-9]*)([^]*)/a.*$',\1) : : (sorry for the word wrap) : : Any help would be greatly appreciated! : : Thanks : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regex question
If you just want to replace all occurences of ~AA (caps only), anywhere in the file and you have the entire file contents in a single variable, the following should work: cfset y = REReplace(x, (~[A-Z]{2}), \1~, all) If you need to discern this character sequence only when it's the only thing on a line, you'll need to step through the file line by line and then use an regex like: cfset y = REReplace(x, ^(~[A-Z]{2})\s*$, \1~, all) - Original Message - From: Larry Juncker [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 11:18 AM Subject: OT: Regex question Sorry for the OT, but I can not get any answers on CF-Regex.. I have the following code in a text file: ~TX which is tildeSTATECODEspace I want to do a regex in my text editor that will find every occurrence of every state and change it to: ~TX~or ~IA~OR ~NC~ I thought that this would do it, but it does not like it: [~[A-Z][:space:]$] for my find row I am using text pad if that makes a difference for the answer. Otherwise I guess I can keep highlighting each state manually. Thanks in advance ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: RegEx Question
I'll explain why this doesn't work. !--s1--[*]!--e1-- This replaces !--s1-- followed by anything followed by !--e1--. The problem is that Regexs are greedy so this replaces !--s1-- followed by anything _including_ !--e1-- What you want is to replace !--s1-- followed by anything UNTIL !--e1--. So you need to do something like !--s1--[^(!--e1--)] - (pseudocode...) Justin -Original Message- From: Duane Boudreau [mailto:[EMAIL PROTECTED]] Sent: 26 November 2002 17:37 To: CF-Talk Subject: RegEx Question I'm not sure why I can not get this to work. What am I doing wrong? I want to replace !--s1--*!--e1-- TIA, Duane cfset myStr1 = blah !--s1--x1 y2!--e1-- blah cfset myStr2 = abc cfset newStr = ReReplaceNoCase(myStr1, !--s1--[*]!--e1--, !--s1--#myStr2#!--e1--) ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
Re: RegEx Question
I'm not sure why I can not get this to work. What am I doing wrong? I want to replace !--s1--*!--e1-- TIA, Duane cfset myStr1 = blah !--s1--x1 y2!--e1-- blah cfset myStr2 = abc cfset newStr = ReReplaceNoCase(myStr1, !--s1--[*]!--e1--, !--s1--#myStr2#!--e1--) Hey Duane, You might want to check out [EMAIL PROTECTED] To answer your question, * means zero or more, so you have to place it after what you want zero or more of... so something like this: cfset newStr = REReplaceNoCase(myStr1,^(.*!--s1--).*(!--e1--.*)$,\1#myStr2#\2) Ought to get you what you want. translated, this expression means start at the beginning of the string (^), find zero or more of anything (.*) followed by !--s1--, followed by anything (.*) followed by !--e1-- followed by anything (.*) to the end of the string ($). Then replace what was found with the first part of the string (\1) -- this is called a backreference and it mirrors what is in the first pair of parenthesis in the expression, followed by my new string, followed by the last part of the string. hth s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: RegEx Question
-Original Message- From: Duane Boudreau [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 26, 2002 12:37 PM To: CF-Talk Subject: RegEx Question I'm not sure why I can not get this to work. What am I doing wrong? I want to replace !--s1--*!--e1-- TIA, Duane cfset myStr1 = blah !--s1--x1 y2!--e1-- blah cfset myStr2 = abc cfset newStr = ReReplaceNoCase(myStr1, !--s1--[*]!--e1--, !--s1--#myStr2#!--e1--) I may be rusty, but here goes... I'm not sure if the string [*] actually means anything - the Asterisk is not a wildcard in RegExs, it's an instance marker (in this case meaning zero or more occurances). The dot is the wildcard for any chracter so this .* might be better. This would make the above RegEx: !--s1--.*!--e1-- Also Regexs in CF are greedy - in short this means that the above would result in the following this conversation (basically): 1) Starting at the beginning of the string, find !--s1-- 2) Okay, found it. Next I have to find all characters. 3) Next, since I just had to find all characters, starting at the END of the string (and moving backwards), find !--e1--. In short if your string was this: blah !--s1--x1 y2!--e1-- blah blah !--s1--x1 y2!--e1-- blah That regex would return this: !--s1--x1 y2!--e1-- blah blah !--s1--x1 y2!--e1-- It would find the first !--s1-- and the LAST !--e1--. There are at least two ways out of this. 1) If the end will ALWAYS be !--e1-- you can add that as a refuse or not clause to your expression as in: !--s1--[.^(!--e1--)]* What (I think) that says is find anything (the dot) that's NOT (the carat) the following subexpression. I think that should work in every version of CF that offer RegExs. 2) Only if you're using CFMX (you didn't say) then you can instruct CF to use minimal-matching (also known as non-greedy matching) by modifying the instance character with a question mark. So, the example from above would be: !--s1--.*?!--e1-- Or possibly !--s1--[.]*?!--e1-- I'm not 100% sure. Again - this can only used in CFMX (and it's so very freaking cool) so your CF version makes a big difference. I hope this helps, Jim Davis ~| 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: regex question
Matthew Walker wrote: result = REFind(report_id=([0-9]+), myString, 1, true); theNumber = Mid(myString, result.pos[2],result.len[2]); ..I think! ;-) You missed a quote in there: REFind(report_id=([0-9]+), myString, 1, true); __ 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: regex question
Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? __ 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: regex question
sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ 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: regex question
Heh - ok. If you know for a fact ther format is ALWAYS: VARNAME=NUMBER You can do: cfset s = report_id=54355 cfset varName = listFirst(report_id,=) cfset value = listLast(report_id,=) !--- remove --- cfset value = replace(value,,,all) !--- set var --- cfset setVariable(varName,value) === Raymond Camden, ColdFusion Jedi Master for Hire Email: [EMAIL PROTECTED] Yahoo IM : cfjedimaster My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:38 AM To: CF-Talk Subject: RE: regex question sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
Yeah, I know Evaluate() isn't generally a good idea. I was just going by the information I had at the time. Subsequent messages had more information making my little suggestion inconsequential. If I could have reached out and pulled the message back I would have. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:38 AM To: CF-Talk Subject: RE: regex question sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ 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: regex question
I think Todd was just joking - and certainly my post was just another way of solving the problem. :) === Raymond Camden, ColdFusion Jedi Master for Hire Email: [EMAIL PROTECTED] Yahoo IM : cfjedimaster My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Everett, Al [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:51 AM To: CF-Talk Subject: RE: regex question Yeah, I know Evaluate() isn't generally a good idea. I was just going by the information I had at the time. Subsequent messages had more information making my little suggestion inconsequential. If I could have reached out and pulled the message back I would have. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:38 AM To: CF-Talk Subject: RE: regex question sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ 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: regex question
this is the fix, last night, that worked/works 100% the report_id=54654654 is part of an xml feed, so I needed to strip everything from that xml feed except that number, which could be any number of digits :) thanks anyway! (I believe Dick Applebaum made the final correct analysis) cfset Report_ID = ReReplaceNocase(sourceString,'.*report_id=([^\]*).*', '\1') ..tony Tony Weeg Senior Web Developer Information System Design Navtrak, Inc. Fleet Management Solutions www.navtrak.net 410.548.2337 -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:46 AM To: CF-Talk Subject: RE: regex question Heh - ok. If you know for a fact ther format is ALWAYS: VARNAME=NUMBER You can do: cfset s = report_id=54355 cfset varName = listFirst(report_id,=) cfset value = listLast(report_id,=) !--- remove --- cfset value = replace(value,,,all) !--- set var --- cfset setVariable(varName,value) === Raymond Camden, ColdFusion Jedi Master for Hire Email: [EMAIL PROTECTED] Yahoo IM : cfjedimaster My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:38 AM To: CF-Talk Subject: RE: regex question sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
s'all good Al, how many times do all of us hit send, just a little too quickly ;-) ..tony Tony Weeg Senior Web Developer Information System Design Navtrak, Inc. Fleet Management Solutions www.navtrak.net 410.548.2337 -Original Message- From: Everett, Al [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:51 AM To: CF-Talk Subject: RE: regex question Yeah, I know Evaluate() isn't generally a good idea. I was just going by the information I had at the time. Subsequent messages had more information making my little suggestion inconsequential. If I could have reached out and pulled the message back I would have. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:38 AM To: CF-Talk Subject: RE: regex question sick'em RAY! On Thu, 22 Aug 2002, Everett, Al wrote: Assuming that string is in a variable 'x', this will do it: cfset #evaluate(x)# -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
Yes I was just joking (don't Tell Ray that... !). ~Todd On Thu, 22 Aug 2002, Raymond Camden wrote: I think Todd was just joking - and certainly my post was just another way of solving the problem. :) === Raymond Camden, ColdFusion Jedi Master for Hire Email: [EMAIL PROTECTED] Yahoo IM : cfjedimaster My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Everett, Al [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 22, 2002 8:51 AM To: CF-Talk Subject: RE: regex question Yeah, I know Evaluate() isn't generally a good idea. I was just going by the information I had at the time. Subsequent messages had more information making my little suggestion inconsequential. If I could have reached out and pulled the message back I would have. -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat (Moderator)| http://www.ultrashock.com/ - webRat (Back-end Moderator) | __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
result = REFind(report_id=([0-9]+), myString, 1, true); theNumber = Mid(myString, result.pos[2],result.len[2]); ..I think! ;-) -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Thursday, 22 August 2002 1:39 p.m. To: CF-Talk Subject: regex question report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: regex question
The way you defined it: cfset report_id = 545687 What you probably mean is something like: cfset report_id = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '/1') Dick On Wednesday, August 21, 2002, at 06:38 PM, Tony Weeg wrote: report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
report_id=545687 is part of an xml feed, that i turn into a var then need to extrapolate that into a var called #reportId# tw -Original Message- From: Dick Applebaum [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:51 PM To: CF-Talk Subject: Re: regex question The way you defined it: cfset report_id = 545687 What you probably mean is something like: cfset report_id = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '/1') Dick On Wednesday, August 21, 2002, at 06:38 PM, Tony Weeg wrote: report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ 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: regex question
cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) tw -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:51 PM To: CF-Talk Subject: RE: regex question result = REFind(report_id=([0-9]+), myString, 1, true); theNumber = Mid(myString, result.pos[2],result.len[2]); .I think! ;-) -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Thursday, 22 August 2002 1:39 p.m. To: CF-Talk Subject: regex question report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
ok, i know, ive got mpd and smart/dumb tony are talking back and forth right, no! my man, the God of CODE, Ryan Peters has shown me the light, AoL inst mess. is great for getting quick tips from great people check this out, does this make sense, can it be done better? cfsavecontent variable=xml_123 xmlorder_detail report_id=545687/xml /cfsavecontent cfset startposition = #findnocase(eport_id=, #xml_123#)# cfif startposition cfset startposition = startposition + 10 /cfif cfset endposition = #find(, xml_123, startposition)# cfset reportid = #mid(xml_123, startposition, endposition - startposition)# cfoutput#ReportId#/cfoutput this works 100% thanks for all your help! tony -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:58 PM To: CF-Talk Subject: RE: regex question cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) tw -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:51 PM To: CF-Talk Subject: RE: regex question result = REFind(report_id=([0-9]+), myString, 1, true); theNumber = Mid(myString, result.pos[2],result.len[2]); I think! ;-) -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Thursday, 22 August 2002 1:39 p.m. To: CF-Talk Subject: regex question report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ 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: regex question
oh, not that this list isnt a great resource, but aol makes it really nice too thanks for all your help everyone! i try to help when i can :) tw -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:04 PM To: CF-Talk Subject: RE: regex question ok, i know, ive got mpd and smart/dumb tony are talking back and forth right, no! my man, the God of CODE, Ryan Peters has shown me the light, AoL inst mess. is great for getting quick tips from great people check this out, does this make sense, can it be done better? cfsavecontent variable=xml_123 xmlorder_detail report_id=545687/xml /cfsavecontent cfset startposition = #findnocase(eport_id=, #xml_123#)# cfif startposition cfset startposition = startposition + 10 /cfif cfset endposition = #find(, xml_123, startposition)# cfset reportid = #mid(xml_123, startposition, endposition - startposition)# cfoutput#ReportId#/cfoutput this works 100% thanks for all your help! tony -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:58 PM To: CF-Talk Subject: RE: regex question cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) tw -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 9:51 PM To: CF-Talk Subject: RE: regex question result = REFind(report_id=([0-9]+), myString, 1, true); theNumber = Mid(myString, result.pos[2],result.len[2]); I think! ;-) -Original Message- From: Tony Weeg [mailto:[EMAIL PROTECTED]] Sent: Thursday, 22 August 2002 1:39 p.m. To: CF-Talk Subject: regex question report_id=545687 if i wanted to find that string above (report_id=545687), and extract the digits from inside the string, and make them a cf variable called reportIdwhats the best way? im struggling with this one. thanks :) ...tony tony weeg [EMAIL PROTECTED] www.revolutionwebdesign.com rEvOlUtIoN wEb DeSiGn 410.334.6331 __ 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: regex question
cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) I realise you've got another solution but for your reference here's the idea. The first line creates a structure of arrays which you would put in a holding variable like result (not reportid). Then the second line grabs the number (the reportid) from the original code based on the instructions in result: cfset result = REFind(report_id=([0-9]+), xml_123, 1, true) cfset ReportId = Mid(xml_123, result.pos[2],result.len[2]) __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: regex question
Here's a one-liner that works on CFMX (Imade a typo in the original post... sorry). cfset sourceString ='some XML stuff... Report_ID=12345 some more XML stuff' cfset Report_ID = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '\1') cfdump var=#sourceString# br cfdump var=#Report_ID# Dick Ahh... Blue crabs what's the temp ... about 70 here in Pasadena On Wednesday, August 21, 2002, at 06:56 PM, Tony Weeg wrote: cfset report_id = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '/1') __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
hi matt, thanks very much for your help! but this is the error i get when i run your code? Error Diagnostic Information Just in time compilation error unknown context error reached at the end of the CFML templateInvalid expression format. The usual cause is an error in the expression structure. The last successfully parsed CFML construct was a CFSET tag occupying document position (14:1) to (14:6). The specific sequence of files included or processed is: D:\www\clients\cx_WebServiceApp\xml_123\test_regex_mid.cfm Date/Time: 08/21/02 22:31:14 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Remote Address: 127.0.0.1 -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:15 PM To: CF-Talk Subject: RE: regex question cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) I realise you've got another solution but for your reference here's the idea. The first line creates a structure of arrays which you would put in a holding variable like result (not reportid). Then the second line grabs the number (the reportid) from the original code based on the instructions in result: cfset result = REFind(report_id=([0-9]+), xml_123, 1, true) cfset ReportId = Mid(xml_123, result.pos[2],result.len[2]) __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
its a balmy 69 degrees 5-10 mph wind off the bay, some of my friends are out on our dock fishing for rockfish ;) nice night! tw -Original Message- From: Dick Applebaum [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:29 PM To: CF-Talk Subject: Re: regex question Here's a one-liner that works on CFMX (Imade a typo in the original post... sorry). cfset sourceString ='some XML stuff... Report_ID=12345 some more XML stuff' cfset Report_ID = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '\1') cfdump var=#sourceString# br cfdump var=#Report_ID# Dick Ahh... Blue crabs what's the temp ... about 70 here in Pasadena On Wednesday, August 21, 2002, at 06:56 PM, Tony Weeg wrote: cfset report_id = ReReplaceNocase(sourceString, '.*report_id=([^\]*).*', '/1') __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: regex question
Your missing a quote cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# This is your original string. the first quote says your starting the string. The 2 quotes after the = is seen by CF as a literal quote within a string. The second group of 2 quotes are also seen as a literal quote within a string. What's missing? The quote that closes the string. cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# I use single quotes within functions in order to avoid such issues: cfset ReportId =#REFind('report_id=([0-9]+)', myString, 1, 1)# hi matt, thanks very much for your help! but this is the error i get when i run your code? Error Diagnostic Information Just in time compilation error unknown context error reached at the end of the CFML templateInvalid expression format. The usual cause is an error in the expression structure. The last successfully parsed CFML construct was a CFSET tag occupying document position (14:1) to (14:6). The specific sequence of files included or processed is: D:\www\clients\cx_WebServiceApp\xml_123\test_regex_mid.cfm Date/Time: 08/21/02 22:31:14 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Remote Address: 127.0.0.1 -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:15 PM To: CF-Talk Subject: RE: regex question cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) I realise you've got another solution but for your reference here's the idea. The first line creates a structure of arrays which you would put in a holding variable like result (not reportid). Then the second line grabs the number (the reportid) from the original code based on the instructions in result: cfset result = REFind(report_id=([0-9]+), xml_123, 1, true) cfset ReportId = Mid(xml_123, result.pos[2],result.len[2]) __ 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: regex question
but this is the error i get when i run your code? I missed a quote. But there may be other errors ;-) cfset result = REFind(report_id=([0-9]+), xml_123, 1, true) cfset ReportId = Mid(xml_123, result.pos[2],result.len[2]) __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: regex question
great, thank you mike ;) thank you matt. dick's one liner, works great cfset Report_ID = ReReplaceNocase(sourceString,'.*report_id=([^\]*).*', '\1') very slick!! tw -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:42 PM To: CF-Talk Subject: Re: regex question Your missing a quote cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# This is your original string. the first quote says your starting the string. The 2 quotes after the = is seen by CF as a literal quote within a string. The second group of 2 quotes are also seen as a literal quote within a string. What's missing? The quote that closes the string. cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# I use single quotes within functions in order to avoid such issues: cfset ReportId =#REFind('report_id=([0-9]+)', myString, 1, 1)# hi matt, thanks very much for your help! but this is the error i get when i run your code? Error Diagnostic Information Just in time compilation error unknown context error reached at the end of the CFML templateInvalid expression format. The usual cause is an error in the expression structure. The last successfully parsed CFML construct was a CFSET tag occupying document position (14:1) to (14:6). The specific sequence of files included or processed is: D:\www\clients\cx_WebServiceApp\xml_123\test_regex_mid.cfm Date/Time: 08/21/02 22:31:14 Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Remote Address: 127.0.0.1 -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 10:15 PM To: CF-Talk Subject: RE: regex question cant seem to get this to jivewhats my issue? cfset ReportId =#REFind(report_id=([0-9]+), myString, 1, true)# cfset theNumber = Mid(myString, result.pos[2],result.len[2]) I realise you've got another solution but for your reference here's the idea. The first line creates a structure of arrays which you would put in a holding variable like result (not reportid). Then the second line grabs the number (the reportid) from the original code based on the instructions in result: cfset result = REFind(report_id=([0-9]+), xml_123, 1, true) cfset ReportId = Mid(xml_123, result.pos[2],result.len[2]) __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Regex question.
i'm not sure what CF's regex syntax is exactly but in other quasi-stand ard types i would use /*\W*\w*2002/ Jeff Fongemie [EMAIL PROTECTED] on 01/29/2002 08:44:02 AM Please respond to [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] cc: Subject: Regex question. Tuesday, January 29, 2002, 9:34:58 AM Hello CF-Talk, I'm using the replacelist function to alter a string. I'm altering a weather forcast that gives this absurdly long list of counties before the actual forecast. So, I would like to do something like: Replace(cfhttp.fileContent, everything that comes before and including 2002, br) I'm trying all sorts of things, but nothing seems to be picking up the *2002 part. Best regards, Jeff Fongemie mailto:[EMAIL PROTECTED] __ 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: Regex question.
oops, omit the first * and slap a $ on there to terminate the string /\w*\W*2002$/ [EMAIL PROTECTED] on 01/29/2002 08:52:16 AM Please respond to [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] cc: Subject: Re: Regex question. i'm not sure what CF's regex syntax is exactly but in other quasi-stand ard types i would use /*\W*\w*2002/ Jeff Fongemie [EMAIL PROTECTED] on 01/29/2002 08:44:02 AM Please respond to [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] cc: Subject: Regex question. Tuesday, January 29, 2002, 9:34:58 AM Hello CF-Talk, I'm using the replacelist function to alter a string. I'm altering a weather forcast that gives this absurdly long list of counties before the actual forecast. So, I would like to do something like: Replace(cfhttp.fileContent, everything that comes before and including 2002, br) I'm trying all sorts of things, but nothing seems to be picking up the *2002 part. Best regards, Jeff Fongemie mailto:[EMAIL PROTECTED] __ 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: Regex question.
Try ReplaceNoCase(cfhttp.fileContent, [ a-zA-Z0-9]+2002, br) Not sure how to broaden this to include symbols (?/;'@) etc..new to regex myself HTH Kola Oyedeji Web developer Macromedia Certified Advanced ColdFusion 5 Developer ekeda ltd http://www.ekeda.co.uk (+44)020-8429-7300 -Original Message- From: Jeff Fongemie [mailto:[EMAIL PROTECTED]] Sent: 29 January 2002 14:44 To: CF-Talk Subject: Regex question. Tuesday, January 29, 2002, 9:34:58 AM Hello CF-Talk, I'm using the replacelist function to alter a string. I'm altering a weather forcast that gives this absurdly long list of counties before the actual forecast. So, I would like to do something like: Replace(cfhttp.fileContent, everything that comes before and including 2002, br) I'm trying all sorts of things, but nothing seems to be picking up the *2002 part. Best regards, Jeff Fongemie mailto:[EMAIL PROTECTED] __ 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