Re: validate w/ regular expressions in cftextarea cf9 not working
Warning: I'm side-stepping your question for a moment... Best-practice is now to use the following (or similar) in place of cftextarea: https://github.com/cfjedimaster/ColdFusion-UI-the-Right-Way/blob/master/chapters/cftextarea/index.md Now, back to our regularly scheduled thread...answer to your question in 3, 2, 1... On Mon, Jul 7, 2014 at 6:08 PM, andy mann a...@sitemann.com wrote: Hi CFers, i am trying to make the form super secure and have added regular expression that works fine in cfinput to cftextarea and it doesn't work...? cftextarea name=mytxt value=#wrds# message=Text - Required. Letters, Numbers and .+()' allowed pattern=^[-a-zA-Z0-9_:+().' ']{1,100}$ height=300 width=700 validate=regular_expression validateat=OnSubmit disabled=No required=No toolbaronfocus=No bindonload=No html=No enabled=Yes visible=Yes richtext=Yes toolbar=Basic / this is in the head script function FCKeditor_OnComplete(editorInstance) { editorInstance.Config[ToolbarSets][BasicPlus] = [ ['SpecialChar','Bold','Italic','Underline','StrikeThrough','Link', 'Unlink','-','Cut','Copy','Paste', 'Find','Replace', '-','FontFormat','FontName','FontSize','TextColor'] ]; editorInstance.EditorWindow.parent.FCK.ToolbarSet.Load('BasicPlus') ; } /script tnx in advance andy ~| 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:358833 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
validate w/ regular expressions in cftextarea cf9 not working
Hi CFers, i am trying to make the form super secure and have added regular expression that works fine in cfinput to cftextarea and it doesn't work...? cftextarea name=mytxt value=#wrds# message=Text - Required. Letters, Numbers and .+()' allowed pattern=^[-a-zA-Z0-9_:+().' ']{1,100}$ height=300 width=700 validate=regular_expression validateat=OnSubmit disabled=No required=No toolbaronfocus=No bindonload=No html=No enabled=Yes visible=Yes richtext=Yes toolbar=Basic / this is in the head script function FCKeditor_OnComplete(editorInstance) { editorInstance.Config[ToolbarSets][BasicPlus] = [ ['SpecialChar','Bold','Italic','Underline','StrikeThrough','Link', 'Unlink','-','Cut','Copy','Paste', 'Find','Replace', '-','FontFormat','FontName','FontSize','TextColor'] ]; editorInstance.EditorWindow.parent.FCK.ToolbarSet.Load('BasicPlus') ; } /script tnx in advance andy ~| 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:358832 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Something about Regular Expressions that I have never understood
So I know how to throw together a regular expression to find an occurrence of a string/match. But what I have never understood how to do is find a match and then a second match and extract or replace what's inbetween. I've always had to resort to saving the first index I find and then running a second search for the next string starting at that index. I think there must be a better way, but I can't figure it out. How would I extract or replace via a regular expression the first value in single quotes (date) inside the parenthesis. Is it possible to do it in one line? Via a back reference or some such animal? format('date','12/12/2010') Brook ~| 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:335413 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Something about Regular Expressions that I have never understood
On Fri, Jul 16, 2010 at 1:33 PM, Brook Davies br...@logiforms.com wrote: How would I extract or replace via a regular expression the first value in single quotes (date) inside the parenthesis. Is it possible to do it in one line? Via a back reference or some such animal? format('date','12/12/2010') Hi Brook, Something like this should do the trick: cfoutput#ReReplace(format('date','12/12/2010'), .+\('([^']+)',.*, \1)#/cfoutput -- Pete Freitag http://foundeo.com/ - ColdFusion Consulting Products http://petefreitag.com/ - My Blog http://hackmycf.com - Is your ColdFusion Server Secure? ~| 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:335416 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Something about Regular Expressions that I have never understood
But what I have never understood how to do is find a match and then a second match and extract or replace what's inbetween. I had the same problem, so I wrote a custom tag to do exactly this easyly: See http://www.cftagstore.com/tags/cfreextract.cfm ~| 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:335417 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Something about Regular Expressions that I have never understood
Pete/Claude, Thanks guys, thats awesome!!! Brook -Original Message- From: Claude Schnéegans schneeg...@internetique.com [mailto:=?ISO-8859-1?Q?Claude_Schn=E9egans schneeg...@interneti=71?= =?ISO-8859-1?Q?ue.com=3E?=] Sent: July-16-10 11:03 AM To: cf-talk Subject: Re: Something about Regular Expressions that I have never understood But what I have never understood how to do is find a match and then a second match and extract or replace what's inbetween. I had the same problem, so I wrote a custom tag to do exactly this easyly: See http://www.cftagstore.com/tags/cfreextract.cfm ~| 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:335418 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
On Wed, May 5, 2010 at 11:38 PM, Charlie Griefer wrote: On Wed, May 5, 2010 at 9:34 PM, denstar wrote: On Mon, May 3, 2010 at 11:46 PM, James Holmes wrote: I hope you have your flameproof suit handy :-P Ah, the cleansing fire of a good library battle. :) It's hot in here. Normally I sleep in this thing, but if nobody's interested, the suit is going on the hook. Oh dear God please let him be wearing something under that suit... It's all good, I've got a towel to sit on! :Den -- The ideas gained by men before they are twenty-five are practically the only ideas they shall have in their lives. William Jam ~| 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:333401 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
It's all good, I've got a towel to sit on! :Den Well I guess that makes you a hoopy frood then! ~| 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:333423 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Help With CF8 Regular Expressions
You're a towel!! -Original Message- From: denstar [mailto:valliants...@gmail.com] Sent: Thursday, May 06, 2010 2:11 AM To: cf-talk Subject: Re: Help With CF8 Regular Expressions On Wed, May 5, 2010 at 11:38 PM, Charlie Griefer wrote: On Wed, May 5, 2010 at 9:34 PM, denstar wrote: On Mon, May 3, 2010 at 11:46 PM, James Holmes wrote: I hope you have your flameproof suit handy :-P Ah, the cleansing fire of a good library battle. ?:) It's hot in here. ?Normally I sleep in this thing, but if nobody's interested, the suit is going on the hook. Oh dear God please let him be wearing something under that suit... It's all good, I've got a towel to sit on! :Den -- The ideas gained by men before they are twenty-five are practically the only ideas they shall have in their lives. William Jam ~| 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:333451 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
On Thu, May 6, 2010 at 10:01 AM, John Morgan wrote: It's all good, I've got a towel to sit on! :Den Well I guess that makes you a hoopy frood then! I'm so hip I can't see over my pelvis. ;) :Den -- These then are my last words to you. Be not afraid of life. Believe that life is worth living and your belief will help create the fact. William James ~| 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:333456 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
On Thu, May 6, 2010 at 5:10 PM, Bobby Hartsfield wrote: You're a towel!! Better than a bowl of petunias or being nekkid. Um... wanna go get high? :Den -- This life is worth living, we can say, since it is what we make it. William James ~| 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:333457 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
On Mon, May 3, 2010 at 11:46 PM, James Holmes wrote: I hope you have your flameproof suit handy :-P Ah, the cleansing fire of a good library battle. :) It's hot in here. Normally I sleep in this thing, but if nobody's interested, the suit is going on the hook. :Den -- The history of philosophy is to a great extent that of a certain clash of human temperaments. William James ~| 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:90 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
On Wed, May 5, 2010 at 9:34 PM, denstar valliants...@gmail.com wrote: On Mon, May 3, 2010 at 11:46 PM, James Holmes wrote: I hope you have your flameproof suit handy :-P Ah, the cleansing fire of a good library battle. :) It's hot in here. Normally I sleep in this thing, but if nobody's interested, the suit is going on the hook. Oh dear God please let him be wearing something under that suit... -- 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. ~| 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:96 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Help With CF8 Regular Expressions
Hi All, I'm trying to come up with a regular expression for CF8 that finds links in text and inserts a call to a pop up window in the on click event. I came up with the following that works in Javascript: myStr.replace(/\s*a\s+([hH][rR][eE][fF])\s*=/g, 'a onclick=popwin(this.href); return false; href='); I now need to convert this to something CF will use and I'm failing miserably. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333291 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
re: Help With CF8 Regular Expressions
how about simplifying? replaceNoCase(myStr, 'a ', 'a onclick=popwin(this.ref); return false; ', 'all'); [note the training space in the test and the replacement] ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333292 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
how about simplifying? replaceNoCase(myStr, 'a ', 'a onclick=popwin(this.ref); return false; ', 'all'); [note the training space in the test and the replacement] ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333297 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
how about simplifying? replaceNoCase(myStr, 'a ', 'a onclick=popwin(this.ref); return false; ', 'all'); [note the training space in the test and the replacement] This doesn't work for: a href=somelocation.cfm Some Place/a My original regex took care of all white space before the a, and any amount of white space between the a and href ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333298 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
OK, that's some pretty sloppy HTML, but let's see. Same principal should work: myVar = reReplaceNoCase(myVar, '\s*a ', 'a onclick=popwin(this.ref); return false; ', 'all'); On 5/3/2010 1:13 PM, Robert Nurse wrote: how about simplifying? replaceNoCase(myStr, 'a ', 'a onclick=popwin(this.ref); return false; ', 'all'); [note the training space in the test and the replacement] This doesn't work for: a href=somelocation.cfmSome Place/a My original regex took care of all white space before the a, and any amount of white space between the a and href ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:07 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
Another option is using Javascript to bind the a element onclick events. It's super simple with both Dojo (the best javascript library on the face of the planet) and something a little more pedestrian, like jQuery. :D Generally the JS route doesn't require you to change as much stuff (and you can limit the bind to links within certain DIV elements and whatnot). :Den -- Nothing is so fatiguing as the eternal hanging on of an uncompleted task. William James On Mon, May 3, 2010 at 5:16 AM, Robert Nurse wrote: Hi All, I'm trying to come up with a regular expression for CF8 that finds links in text and inserts a call to a pop up window in the on click event. I came up with the following that works in Javascript: myStr.replace(/\s*a\s+([hH][rR][eE][fF])\s*=/g, 'a onclick=popwin(this.href); return false; href='); I now need to convert this to something CF will use and I'm failing miserably. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:09 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With CF8 Regular Expressions
I hope you have your flameproof suit handy :-P mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ On 4 May 2010 08:19, denstar valliants...@gmail.com wrote: It's super simple with both Dojo (the best javascript library on the face of the planet) and something a little more pedestrian, like jQuery. :D ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:15 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Help With Regular Expressions
I ended up using Replace to change ../geos/displayCountryData.cfm?countryCode=AS to ../geos/AS. Then I used REMatch(../geos/[A-Z]{2},...) to find all occurrences of this resulting pattern. I then processed each match in the array REMatch returned with Replace(DBText, REMatchArrayEntry, REMatchArrayEntry .html, ALL). Each REMatchArrayEntry has the pattern ../geos/[A-Z]{2}. I'm sure there is a simpler way to handle this. But, this works. Can you provide one more of the actual links? I'm going to assume that the folderName string is not actually 'folderName'. If that's the case then it would affect the regular expression and what it would need to look for. Will the two character string always be at the end of the link? If everything else is the same, and you just need the last two characters of a link: cfset string = '../folderName/someCFMFile.cfm?code=AB' cfset match = REMatchNoCase('[A-Z]{2}$',string) cfdump var=#match# cfabort ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322461 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Help With Regular Expressions
Hi All, I'm trying to find a way of using regular expressions to locate and replace text. My application reads in some text containing links from a DB: e.g. ../folderName/someCFMFile.cfm?code=AB. I want to change all occurrences of this to ../folderName/AB.html. Note that code can be any 2-uppercase-character combination. I've gotten to the point where I have ../folderName/code using: cfset aData = Replace(stringFromDB, someCFMFile.cfm, , ALL) cfset aData = REReplace(aData, ../folderName/[A-Z]{2}, aData, ALL) My problem is how to get it to replace what it matches with that same match (which would be ../folderName/code) with ../folderName/code.html? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322427 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Help With Regular Expressions
This is untested, but should be close. REReplace(string, [a-zA-Z0-9_-]+\.cfm\?code=([A-Z]{2}), \1.html, all) find zero or more a-zA-Z0-9_-, then .cfm?code=, then any two A-Z and replace the whole thing with thos upper case letters plus .html. If someCFMFile.cfm is static, you can replace that character class with the literal. cheers, barneyb On Tue, May 12, 2009 at 9:20 AM, Robert Nurse rnu...@gmail.com wrote: Hi All, I'm trying to find a way of using regular expressions to locate and replace text. My application reads in some text containing links from a DB: e.g. ../folderName/someCFMFile.cfm?code=AB. I want to change all occurrences of this to ../folderName/AB.html. Note that code can be any 2-uppercase-character combination. I've gotten to the point where I have ../folderName/code using: cfset aData = Replace(stringFromDB, someCFMFile.cfm, , ALL) cfset aData = REReplace(aData, ../folderName/[A-Z]{2}, aData, ALL) My problem is how to get it to replace what it matches with that same match (which would be ../folderName/code) with ../folderName/code.html? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322428 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Help With Regular Expressions
Can you provide one more of the actual links? I'm going to assume that the folderName string is not actually 'folderName'. If that's the case then it would affect the regular expression and what it would need to look for. Will the two character string always be at the end of the link? If everything else is the same, and you just need the last two characters of a link: cfset string = '../folderName/someCFMFile.cfm?code=AB' cfset match = REMatchNoCase('[A-Z]{2}$',string) cfdump var=#match# cfabort -Original Message- From: Robert Nurse [mailto:rnu...@gmail.com] Sent: Tuesday, May 12, 2009 11:20 AM To: cf-talk Subject: Help With Regular Expressions Hi All, I'm trying to find a way of using regular expressions to locate and replace text. My application reads in some text containing links from a DB: e.g. ../folderName/someCFMFile.cfm?code=AB. I want to change all occurrences of this to ../folderName/AB.html. Note that code can be any 2-uppercase-character combination. I've gotten to the point where I have ../folderName/code using: cfset aData = Replace(stringFromDB, someCFMFile.cfm, , ALL) cfset aData = REReplace(aData, ../folderName/[A-Z]{2}, aData, ALL) My problem is how to get it to replace what it matches with that same match (which would be ../folderName/code) with ../folderName/code.html? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322429 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Help with Regular expressions
It is saying any character in the set that is not a-z or 0-9. NOTE: He's testing that a bad character is found (instead of that only good characters are found) which should be slightly faster since it can return false at the first bad character found. Make not of the ReFind**NOCASE** :) That could trip you up if you used REFind. -jeff Trying to wrap my head around this and get it to work with the framework I'm using...what does this say, in words... [^a-z0-9] does it say characters other than a-z, 0-9 or only characters a-z, o-9? thanks cfif REFindNoCase([^a-z0-9], yourString) Bad chars /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298071 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Help with Regular expressions
Mark Fuqua wrote: Trying to wrap my head around this and get it to work with the framework I'm using...what does this say, in words... [^a-z0-9] does it say characters other than a-z, 0-9 or only characters a-z, o-9? thanks The ^ character is the 'NOT' operand of regex when used inside of a character class [...] set. For example [a-z0-9] says match any character set of 0-9 or a-z (case sensitive). Adding the carrot ^ reverses this, i.e. [^a-z0-9] means any character NOT in the set of 0-9 or a-z. Just note that the meaning of the carrot ^ symbol changes its meaning when outside of a character set [...]. Outside of this it matches the beginning of the string and|or line. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298072 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Help with Regular expressions
inside of the brackets, the caret (^) means 'not'. so that's anything that's NOT a-z (or A-Z since adrian gave you a replacenocase() function) or 0-9. On Feb 4, 2008 8:56 AM, Mark Fuqua [EMAIL PROTECTED] wrote: Trying to wrap my head around this and get it to work with the framework I'm using...what does this say, in words... [^a-z0-9] does it say characters other than a-z, 0-9 or only characters a-z, o-9? thanks -Original Message- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, February 04, 2008 11:32 AM To: CF-Talk Subject: RE: Help with Regular expressions cfif REFindNoCase([^a-z0-9], yourString) Bad chars /cfif Adrian -Original Message- From: Mark Fuqua Sent: 04 February 2008 16:30 To: CF-Talk Subject: Help with Regular expressions I need to check and see that a form field has no special characters or spaces, only 0-9 and a-z. I'm guessing a regular expression could do that.? I need a regular expression to do a pattern matching test.if it has anything other than a-z or 0-9 it should fail. Thanks Mark Fuqua ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298070 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Help with Regular expressions
Trying to wrap my head around this and get it to work with the framework I'm using...what does this say, in words... [^a-z0-9] does it say characters other than a-z, 0-9 or only characters a-z, o-9? thanks -Original Message- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, February 04, 2008 11:32 AM To: CF-Talk Subject: RE: Help with Regular expressions cfif REFindNoCase([^a-z0-9], yourString) Bad chars /cfif Adrian -Original Message- From: Mark Fuqua Sent: 04 February 2008 16:30 To: CF-Talk Subject: Help with Regular expressions I need to check and see that a form field has no special characters or spaces, only 0-9 and a-z. I'm guessing a regular expression could do that.? I need a regular expression to do a pattern matching test.if it has anything other than a-z or 0-9 it should fail. Thanks Mark Fuqua ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298069 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Help with Regular expressions
I need to check and see that a form field has no special characters or spaces, only 0-9 and a-z. I'm guessing a regular expression could do that.? I need a regular expression to do a pattern matching test.if it has anything other than a-z or 0-9 it should fail. Thanks Mark Fuqua ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298064 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Help with Regular expressions
cfif REFindNoCase([^a-z0-9], yourString) Bad chars /cfif Adrian -Original Message- From: Mark Fuqua Sent: 04 February 2008 16:30 To: CF-Talk Subject: Help with Regular expressions I need to check and see that a form field has no special characters or spaces, only 0-9 and a-z. I'm guessing a regular expression could do that.? I need a regular expression to do a pattern matching test.if it has anything other than a-z or 0-9 it should fail. Thanks Mark Fuqua ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298065 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
regular expressions
Hi.. i have some html files which i need to be able to read and find all referenced files in it. Like all jpg, gif, css, js files etc that are being used inside the html tags. I don't need the paths, just the filenames. I know i need to to use regular expressions to do so can someone give me any ideas for it? Thanks, K ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295502 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regular expressions
i have some html files which i need to be able to read and find all referenced files in it. Like all jpg, gif, css, js files etc that are being used inside the html tags. This is a job for CF_REExtract! See: http://www.contentbox.com/claude/customtags/REextract/testREextract.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. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295503 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
On Dec 28, 2007 2:11 PM, Claude Schneegans [EMAIL PROTECTED] wrote: i have some html files which i need to be able to read and find all referenced files in it. Like all jpg, gif, css, js files etc that are being used inside the html tags. This is a job for CF_REExtract! See: http://www.contentbox.com/claude/customtags/REextract/testREextract.cfm yeah, didn't see that coming :) -- Scientists tell us that the fastest animal on earth, with a top speed of 120 feet per second, is a cow that has been dropped out of a helicopter. - Dave Barry ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295504 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regular expressions
yeah, didn't see that coming LOL... always ready to help people -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295507 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regular expressions
thanks guys any other ideas, code samples etc? On Dec 28, 2007 6:13 PM, Claude Schneegans [EMAIL PROTECTED] wrote: yeah, didn't see that coming LOL... always ready to help people -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295508 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
any other ideas Don't ask me ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295509 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regular expressions
I know some regex people are going to jump all over this but I really don't know regex.. Try this on 8 with a html page in the same directory, It will give you an array of structures with information about the images in a html document. html head titleRegEx PlayGround/title /head body !--- read the html file --- cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img[^]*/, htmldoc) cfset files = arrayNew(1) cfloop array=#images# index=i cfset imgpath = REMatchNoCase(.*, i) cfset imgpath = replace(imgpath[1],,,all) cfset tmp = structNew() cfset tmp.path = imgpath cfset tmp.filename = listLast(imgpath,/) cfset tmp.fileExtension = right(imgpath,3) cfset tmp.filetype = image cfset arrayAppend(files,tmp) /cfloop cfdump var=#files# /body /html On Dec 28, 2007 6:33 PM, Claude Schneegans [EMAIL PROTECTED] wrote: any other ideas Don't ask me ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295510 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
Thanks Dan... i tried your code... all i getting in the cfdump is an empty array. Any ideas? On Dec 28, 2007 11:32 PM, Dan Vega [EMAIL PROTECTED] wrote: I know some regex people are going to jump all over this but I really don't know regex.. Try this on 8 with a html page in the same directory, It will give you an array of structures with information about the images in a html document. html head titleRegEx PlayGround/title /head body !--- read the html file --- cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img[^]*/, htmldoc) cfset files = arrayNew(1) cfloop array=#images# index=i cfset imgpath = REMatchNoCase(.*, i) cfset imgpath = replace(imgpath[1],,,all) cfset tmp = structNew() cfset tmp.path = imgpath cfset tmp.filename = listLast(imgpath,/) cfset tmp.fileExtension = right(imgpath,3) cfset tmp.filetype = image cfset arrayAppend(files,tmp) /cfloop cfdump var=#files# /body /html On Dec 28, 2007 6:33 PM, Claude Schneegans [EMAIL PROTECTED] wrote: any other ideas Don't ask me ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295511 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
Dan, I just did a cfdump for variable images in your code. Even that shows up an empty array... are you sure the regular expression is correct in this line? cfset images = REMatchNoCase(img[^]*/, htmldoc) On Dec 28, 2007 11:32 PM, Dan Vega [EMAIL PROTECTED] wrote: I know some regex people are going to jump all over this but I really don't know regex.. Try this on 8 with a html page in the same directory, It will give you an array of structures with information about the images in a html document. html head titleRegEx PlayGround/title /head body !--- read the html file --- cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img[^]*/, htmldoc) cfset files = arrayNew(1) cfloop array=#images# index=i cfset imgpath = REMatchNoCase(.*, i) cfset imgpath = replace(imgpath[1],,,all) cfset tmp = structNew() cfset tmp.path = imgpath cfset tmp.filename = listLast(imgpath,/) cfset tmp.fileExtension = right(imgpath,3) cfset tmp.filetype = image cfset arrayAppend(files,tmp) /cfloop cfdump var=#files# /body /html On Dec 28, 2007 6:33 PM, Claude Schneegans [EMAIL PROTECTED] wrote: any other ideas Don't ask me ;-) -- ___ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: [EMAIL PROTECTED]) Thanks. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295512 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
Yes. I am reading a html file. I changed the first regular expression like this: cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img([^]*[^/]), htmldoc) This gives me a cfdump of all img tags. but the next few lines are doing something that results in an empty array at the end. But now I am getting a CF error: The element at position 1 of dimension 1, of array variable IMGPATH, cannot be found. The error occurred in C:\regexp.cfm: line 17 15 : cfloop array=#images# index=i 16 : cfset imgpath = REMatchNoCase(.*, i) 17 : cfset imgpath = replace(imgpath[1],,,all) 18 : cfset tmp = structNew() 19 : cfset tmp.path = imgpath ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295513 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: regular expressions
yes. i am sure about that. I have CF8. I think i found out what the problem is. Some of the img tags have no double quotes in them... like this.. img src=/img/jjj.gif instead of img src=/img/jjj.gif On Dec 29, 2007 1:08 AM, Dan Vega [EMAIL PROTECTED] wrote: are you sure your on CF8? REMatchNoCase is a cf8 function? On Dec 29, 2007 12:53 AM, Web Exp [EMAIL PROTECTED] wrote: Yes. I am reading a html file. I changed the first regular expression like this: cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img([^]*[^/]), htmldoc) This gives me a cfdump of all img tags. but the next few lines are doing something that results in an empty array at the end. But now I am getting a CF error: The element at position 1 of dimension 1, of array variable IMGPATH, cannot be found. The error occurred in C:\regexp.cfm: line 17 15 : cfloop array=#images# index=i 16 : cfset imgpath = REMatchNoCase(.*, i) 17 : cfset imgpath = replace(imgpath[1],,,all) 18 : cfset tmp = structNew() 19 : cfset tmp.path = imgpath -- Thank You Dan Vega [EMAIL PROTECTED] http://www.danvega.org ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295514 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: regular expressions
Dan... i also need to do the same thing in CF 7... do you know a quick way to do that too? On Dec 29, 2007 1:11 AM, Web Exp [EMAIL PROTECTED] wrote: yes. i am sure about that. I have CF8. I think i found out what the problem is. Some of the img tags have no double quotes in them... like this.. img src=/img/jjj.gif instead of img src=/img/jjj.gif On Dec 29, 2007 1:08 AM, Dan Vega [EMAIL PROTECTED] wrote: are you sure your on CF8? REMatchNoCase is a cf8 function? On Dec 29, 2007 12:53 AM, Web Exp [EMAIL PROTECTED] wrote: Yes. I am reading a html file. I changed the first regular expression like this: cffile action=read file=#expandPath('homepage.html')# variable=htmldoc !--- return an array of image tags --- cfset images = REMatchNoCase(img([^]*[^/]), htmldoc) This gives me a cfdump of all img tags. but the next few lines are doing something that results in an empty array at the end. But now I am getting a CF error: The element at position 1 of dimension 1, of array variable IMGPATH, cannot be found. The error occurred in C:\regexp.cfm: line 17 15 : cfloop array=#images# index=i 16 : cfset imgpath = REMatchNoCase(.*, i) 17 : cfset imgpath = replace(imgpath[1],,,all) 18 : cfset tmp = structNew() 19 : cfset tmp.path = imgpath -- Thank You Dan Vega [EMAIL PROTECTED] http://www.danvega.org ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295515 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regular expressions and bluedragon?
Hi, I am running bluedragon free edition and I am trying to write a regular expression to remove part of a query string. I grab the query string from cgi.query_string and store it as a variable location. The substring I would like to remove would always be either lang=1 lang=2 or lang=3 - it could appear without the (as the first element in the query string). So, I tried creating a regular expression to remove it and came up with the following: cfset location = ReplaceNoCase(location,[:punct:]?lang=[0-9], , ALL) It does not work. I decided to work in steps and tried this, without worrying about the punctation: cfset location = ReplaceNoCase(location,lang=[0-9], , ALL) So, I tried this: cfset location = ReplaceNoCase(location,lang=, , ALL) And it worked, but it isn't doing what I want. So it seems other than literal strings (like lang=) I can't get any regular expression to work. To test, I did the following: cfset teststring = thisthat=3 cfset teststring = ReplaceNoCase(teststring,[0-9], , ALL) It does nothing. Am I doing something wrong? Thanks. Doug ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255879 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Regular expressions and bluedragon?
Doug Hyde wrote: So, I tried creating a regular expression to remove it and came up with the following: cfset location = ReplaceNoCase(location,[:punct:]?lang=[0-9], , ALL) You need REReplace(), not Replace(). Jochem ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255880 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Regulazy - Visual Regular Expressions builder...
Check this out... http://tools.osherove.com/Regulazy/tabid/182/Default.aspx Looks like it could be a really handy tool once it's made it to a full release. !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:246078 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Regulazy - Visual Regular Expressions builder...
That does look pretty cool. Right now, I swear by the RegEx Coach ( http://weitz.de/regex-coach/ ), but it only helps you evaluate regular expression, not build them. I am always looking for the best thing out there. ... Ben Nadel www.bennadel.com -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 9:27 AM To: CF-Talk Subject: Regulazy - Visual Regular Expressions builder... Check this out... http://tools.osherove.com/Regulazy/tabid/182/Default.aspx Looks like it could be a really handy tool once it's made it to a full release. !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:246084 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regulazy - Visual Regular Expressions builder...
On Tuesday 11 July 2006 14:26, Andy Matthews wrote: Looks like it could be a really handy tool once it's made it to a full release. Except it (can) build expressions that have MS specific bits in (like the variable naming). -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:246088 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Regular Expressions - Strip HTML tags. Please help!!!
Thank you guys for pointing me to the right direction. The udf StripTags is really god sent. Thanks cfcoder CFLib.org is your friend :) Check out the function called StripTags. It does exactly what you want. http://www.cflib.org/udf.cfm?ID=774 Cedric ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238004 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Regular Expressions - Strip HTML tags. Please help!!!
Hello Everybody, I need your help with regular expressions. I'm trying to strip out HTML tags from a string to pass it to a flash movie. I've found a script that does this but the problem is that I want to keep some html formatting specifically the following tags: b, br, span, i, strong, div, p Here is the code: cfscript function StripHTML(str) { return REReplaceNoCase(str,[^]*,br,ALL); } /cfscript cfset logtext = table trtdpspan class=bodyThis is some example text/span/p/td/tr trtdbFriday 17 march, 2006/bbr12:54 PM/td/tr /table cfset str = StripHTML(logtext) The above script strips out the everything between the opening and closing angle brackets and . Is there any way to tell the regular expression to do the above but not process the following tags: b, br, span, i, strong, div, p I would be really greatful if someone could post the regular expression to do this. Best regards, cfcoder ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237683 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regular Expressions - Strip HTML tags. Please help!!!
You may have to use a negative lookahead. Try something like this: (?!\/?(br|b|span|i|strong|div|p))[^]* This hasn't been tested and is purely from memory, but I think that (or something close to it) should remove any tag that is *NOT* the open or closing tag of one you listed. For more information on negative lookaheads you can look at the livedocs or google 'regex negative lookahead'. hth. On 4/13/06, cf coder [EMAIL PROTECTED] wrote: Hello Everybody, I need your help with regular expressions. I'm trying to strip out HTML tags from a string to pass it to a flash movie. I've found a script that does this but the problem is that I want to keep some html formatting specifically the following tags: b, br, span, i, strong, div, p Here is the code: cfscript function StripHTML(str) { return REReplaceNoCase(str,[^]*,br,ALL); } /cfscript cfset logtext = table trtdpspan class=bodyThis is some example text/span/p/td/tr trtdbFriday 17 march, 2006/bbr12:54 PM/td/tr /table cfset str = StripHTML(logtext) The above script strips out the everything between the opening and closing angle brackets and . Is there any way to tell the regular expression to do the above but not process the following tags: b, br, span, i, strong, div, p I would be really greatful if someone could post the regular expression to do this. Best regards, cfcoder ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237697 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regular Expressions - Strip HTML tags. Please help!!!
Not sure if this has been suggested (coming in late), but this function works well. http://www.cflib.org/udf.cfm?ID=774 (Thanks Isaac) Not a simple regex, but it gets the job done. On 4/13/06, cf coder [EMAIL PROTECTED] wrote: Hello Everybody, I need your help with regular expressions. I'm trying to strip out HTML tags from a string to pass it to a flash movie. I've found a script that does this but the problem is that I want to keep some html formatting specifically the following tags: b, br, span, i, strong, div, p ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237699 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regular Expressions - Strip HTML tags. Please help!!!
Yeah I hawked it. :P Thanks Jerry. I love that people like this function so much, it makes me smile whenever I see it recommended, because I know I've helped them. :) I wrote an article for CFDJ that should be in the next issue(?) about an alternative approach of using XML and a CFC to handle user-provided xhtml content and remove tags. Not sure if this has been suggested (coming in late), but this function works well. http://www.cflib.org/udf.cfm?ID=774 (Thanks Isaac) Not a simple regex, but it gets the job done. On 4/13/06, cf coder [EMAIL PROTECTED] wrote: Hello Everybody, I need your help with regular expressions. I'm trying to strip out HTML tags from a string to pass it to a flash movie. I've found a script that does this but the problem is that I want to keep some html formatting specifically the following tags: b, br, span, i, strong, div, p s. isaac dealey 434.293.6201 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237703 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regular Expressions - Strip HTML tags. Please help!!!
CFLib.org is your friend :) Check out the function called StripTags. It does exactly what you want. http://www.cflib.org/udf.cfm?ID=774 Cedric ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237707 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Regular Expressions - Strip HTML tags. Please help!!!
HI cfCoder You could try something along these lines: reReplaceNoCase(str,(font)[^]*,,all) replaceNoCase(returnStr,/font,,all) You could then be selective to the tags you wish to strip out. Hope this helps. All the best Jose Diaz On 4/13/06, cf coder [EMAIL PROTECTED] wrote: Hello Everybody, I need your help with regular expressions. I'm trying to strip out HTML tags from a string to pass it to a flash movie. I've found a script that does this but the problem is that I want to keep some html formatting specifically the following tags: b, br, span, i, strong, div, p Here is the code: cfscript function StripHTML(str) { return REReplaceNoCase(str,[^]*,br,ALL); } /cfscript cfset logtext = table trtdpspan class=bodyThis is some example text/span/p/td/tr trtdbFriday 17 march, 2006/bbr12:54 PM/td/tr /table cfset str = StripHTML(logtext) The above script strips out the everything between the opening and closing angle brackets and . Is there any way to tell the regular expression to do the above but not process the following tags: b, br, span, i, strong, div, p I would be really greatful if someone could post the regular expression to do this. Best regards, cfcoder ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237725 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
Dreamweaver regular expressions
Is there a lower case switch in dreamweaver's find and replace regular expressions? I need to convert all my results to lowercase. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.12.2/137 - Release Date: 10/16/2005 ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221265 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: Questions on a dynamic tab delimited export and regular expressions
Is or was it the quotes cffile action=append file=#tempfile# output=cfloop list= -- ??? -Dan -Original Message- From: Doug Hyde [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 02, 2005 8:28 PM To: CF-Talk Subject: Questions on a dynamic tab delimited export and regular expressions Help please... I am trying to create a little custom tag that allows someone to query a database, and then (if they decide) have the results of the query sent to them as a tab delimited file by email. The user can select any number of fields. The data is in sql server, and some of it is in ntext columns, and in some cases has tabs in it (commas won't work...more commas than tabs). So, I have two challenges. First, because the user can select any of the fields they want, I don't always know what the column names are ahead of time. To resolve this for column headings in the export file, I created a tab-delimited list based on query.columnlist. However, it gets tricky for the actual data...I loop through the query, and append each value. What I need to do is run a regular expression inside this loop...but I am not sure how to (1) dynamically generate the variable from the query based on and (2) run a regular expression on any ntext fields to remove returns.here is my code - throws an error at output in cffile (doesn't like the loop). The loop works fine out of the cffile tag. Any thoughts? cfoutput query=getData cffile action=append file=#tempfile# output=cfloop list=#getData.columnList# index=i cfif findnocase('mem',i) cfset temp = rereplace(setvariable(i,#evaluate('getData.'i)#),replacethis,replacewith)c hr(9) cfelse cfset temp = setvariable(i,#evaluate('getData.'i)#)chr(9) /cfif cfoutput#temp#/cfoutput /cfloop addnewline=Yes /cfoutput Thanks. D ~| 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:197313 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: Questions on a dynamic tab delimited export and regular expressions
Please by all means use cfsavecontent for your output variable. cfsavecontent variable=myVar Do stuff /cfsavecontent cffile output=#variables.myVar# ~| 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:197314 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
Questions on a dynamic tab delimited export and regular expressions
Help please... I am trying to create a little custom tag that allows someone to query a database, and then (if they decide) have the results of the query sent to them as a tab delimited file by email. The user can select any number of fields. The data is in sql server, and some of it is in ntext columns, and in some cases has tabs in it (commas won't work...more commas than tabs). So, I have two challenges. First, because the user can select any of the fields they want, I don't always know what the column names are ahead of time. To resolve this for column headings in the export file, I created a tab-delimited list based on query.columnlist. However, it gets tricky for the actual data...I loop through the query, and append each value. What I need to do is run a regular expression inside this loop...but I am not sure how to (1) dynamically generate the variable from the query based on and (2) run a regular expression on any ntext fields to remove returns.here is my code - throws an error at output in cffile (doesn't like the loop). The loop works fine out of the cffile tag. Any thoughts? cfoutput query=getData cffile action=append file=#tempfile# output=cfloop list=#getData.columnList# index=i cfif findnocase('mem',i) cfset temp = rereplace(setvariable(i,#evaluate('getData.'i)#),replacethis,replacewith)c hr(9) cfelse cfset temp = setvariable(i,#evaluate('getData.'i)#)chr(9) /cfif cfoutput#temp#/cfoutput /cfloop addnewline=Yes /cfoutput Thanks. D ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197217 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: Questions on a dynamic tab delimited export and regular expressions
First up you can't have cfml tags in the output attribute of cffile. If you wanted to do something similar you could either build up a string or use cfsavecontent: cfset str = cfset str = str Something cfset str = str Something else cfset str = str More stuff cffile output=#str# or: cfsavecontent variable=str A bunch of code here, the output of which would be in the variable 'str' /cfsavecontent cffile output=#str# But that's an aside. Are you sure you want to give the user a tab/return delimited file when the data may have genuine tabs and returns in? How about XML? For example: data row columnNameOnedata here/columnNameOne columnNameTwodata here/columnNameTwo columnNameThreedata here/columnNameThree columnNameFourdata here/columnNameFour /row /data You can use XMLFormat() to escape certain characters and/or use CDATA islands. I'm a little rusty on those at the moment but I'm sure there's a good time to use them. Here's some quick code: cfxml variable=xmlData cfloop query=getData data row cfloop list=#getData.ColumnList# index=i #i##XMLFormat(getData[i][getData.CurrentRow])#/#i# /cfloop /row /data /cfloop /cfxml cffile action=WRITE file=#tempfile# output=#ToString(xmlData)# You still have a nested loop but you've lost the RegEx's, Evaluate()/SetVariable() and you write to the file only once, which on the face of it sounds faster but I don't have any proof. Not exactly what you asked for but another idea for you to think about. Ade -Original Message- From: Doug Hyde [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 01:28 To: CF-Talk Subject: Questions on a dynamic tab delimited export and regular expressions Help please... I am trying to create a little custom tag that allows someone to query a database, and then (if they decide) have the results of the query sent to them as a tab delimited file by email. The user can select any number of fields. The data is in sql server, and some of it is in ntext columns, and in some cases has tabs in it (commas won't work...more commas than tabs). So, I have two challenges. First, because the user can select any of the fields they want, I don't always know what the column names are ahead of time. To resolve this for column headings in the export file, I created a tab-delimited list based on query.columnlist. However, it gets tricky for the actual data...I loop through the query, and append each value. What I need to do is run a regular expression inside this loop...but I am not sure how to (1) dynamically generate the variable from the query based on and (2) run a regular expression on any ntext fields to remove returns.here is my code - throws an error at output in cffile (doesn't like the loop). The loop works fine out of the cffile tag. Any thoughts? cfoutput query=getData cffile action=append file=#tempfile# output=cfloop list=#getData.columnList# index=i cfif findnocase('mem',i) cfset temp = rereplace(setvariable(i,#evaluate('getData.'i)#),replacethis,replacewith)c hr(9) cfelse cfset temp = setvariable(i,#evaluate('getData.'i)#)chr(9) /cfif cfoutput#temp#/cfoutput /cfloop addnewline=Yes /cfoutput Thanks. D -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 01/03/2005 ~| 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:197218 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: Questions on a dynamic tab delimited export and regular expressions
Cool...thanks. Figured I was thinking in a box, and needed someone to let me out. I will try the xml approach. D -Original Message- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 02, 2005 9:09 PM To: CF-Talk Subject: RE: Questions on a dynamic tab delimited export and regular expressions First up you can't have cfml tags in the output attribute of cffile. If you wanted to do something similar you could either build up a string or use cfsavecontent: cfset str = cfset str = str Something cfset str = str Something else cfset str = str More stuff cffile output=#str# or: cfsavecontent variable=str A bunch of code here, the output of which would be in the variable 'str' /cfsavecontent cffile output=#str# But that's an aside. Are you sure you want to give the user a tab/return delimited file when the data may have genuine tabs and returns in? How about XML? For example: data row columnNameOnedata here/columnNameOne columnNameTwodata here/columnNameTwo columnNameThreedata here/columnNameThree columnNameFourdata here/columnNameFour /row /data You can use XMLFormat() to escape certain characters and/or use CDATA islands. I'm a little rusty on those at the moment but I'm sure there's a good time to use them. Here's some quick code: cfxml variable=xmlData cfloop query=getData data row cfloop list=#getData.ColumnList# index=i #i##XMLFormat(getData[i][getData.CurrentRow])#/#i# /cfloop /row /data /cfloop /cfxml cffile action=WRITE file=#tempfile# output=#ToString(xmlData)# You still have a nested loop but you've lost the RegEx's, Evaluate()/SetVariable() and you write to the file only once, which on the face of it sounds faster but I don't have any proof. Not exactly what you asked for but another idea for you to think about. Ade -Original Message- From: Doug Hyde [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 01:28 To: CF-Talk Subject: Questions on a dynamic tab delimited export and regular expressions Help please... I am trying to create a little custom tag that allows someone to query a database, and then (if they decide) have the results of the query sent to them as a tab delimited file by email. The user can select any number of fields. The data is in sql server, and some of it is in ntext columns, and in some cases has tabs in it (commas won't work...more commas than tabs). So, I have two challenges. First, because the user can select any of the fields they want, I don't always know what the column names are ahead of time. To resolve this for column headings in the export file, I created a tab-delimited list based on query.columnlist. However, it gets tricky for the actual data...I loop through the query, and append each value. What I need to do is run a regular expression inside this loop...but I am not sure how to (1) dynamically generate the variable from the query based on and (2) run a regular expression on any ntext fields to remove returns.here is my code - throws an error at output in cffile (doesn't like the loop). The loop works fine out of the cffile tag. Any thoughts? cfoutput query=getData cffile action=append file=#tempfile# output=cfloop list=#getData.columnList# index=i cfif findnocase('mem',i) cfset temp = rereplace(setvariable(i,#evaluate('getData.'i)#),replacethis,replacewith)c hr(9) cfelse cfset temp = setvariable(i,#evaluate('getData.'i)#)chr(9) /cfif cfoutput#temp#/cfoutput /cfloop addnewline=Yes /cfoutput Thanks. D -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 01/03/2005 ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197219 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Regular Expressions: Extract code between BODY tags
All: I have a complete HTML file, beginning with doctype declaration and ending with a closing HTML tag, from which I'd like to programmatically strip away everything but the code between (and not including) the BODY tags.That is, only the code (including tags) between the BODY tags should remain.Can anyone provide the RE to accomplish this? TIA -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
rereplacenocase(string, 'body[^]*(.+)/body', \1) Your looking for the body tag with anything in it, then everything after that body tag that does not include the ending body tag. Using REReplace is the most efficient here as your peeling off what you don't want (i.e. whats not body content) _ From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 10:48 AM To: CF-Talk Subject: Regular Expressions: Extract code between BODY tags All: I have a complete HTML file, beginning with doctype declaration and ending with a closing HTML tag, from which I'd like to programmatically strip away everything but the code between (and not including) the BODY tags.That is, only the code (including tags) between the BODY tags should remain.Can anyone provide the RE to accomplish this? TIA -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
You, sir, are a saint.Thank you. Here's the code I ended up using: REReplaceNoCase(contents, '.+body[^]*(.+)/body.+', \1) As it was, it removed the BODY tags but not the contents before and after them. Again, thanks. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ Michael Dinowitz wrote: rereplacenocase(string, 'body[^]*(.+)/body', \1) Your looking for the body tag with anything in it, then everything after that body tag that does not include the ending body tag. Using REReplace is the most efficient here as your peeling off what you don't want (i.e. whats not body content) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
The additions are correct. I was a bit hasty in my posting. _ From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 11:20 AM To: CF-Talk Subject: RE: Regular Expressions: Extract code between BODY tags You, sir, are a saint.Thank you. Here's the code I ended up using: REReplaceNoCase(contents, '.+body[^]*(.+)/body.+', \1) As it was, it removed the BODY tags but not the contents before and after them. Again, thanks. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ Michael Dinowitz wrote: rereplacenocase(string, 'body[^]*(.+)/body', \1) Your looking for the body tag with anything in it, then everything after that body tag that does not include the ending body tag. Using REReplace is the most efficient here as your peeling off what you don't want (i.e. whats not body content) _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
Actually this should be rereplacenocase(string, '.*body[^]*(.+)/body.*', \1) Pascal -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: 14 September 2004 16:54 To: CF-Talk Subject: [Spam?] RE: Regular Expressions: Extract code between BODY tags rereplacenocase(string, 'body[^]*(.+)/body', \1) Your looking for the body tag with anything in it, then everything after that body tag that does not include the ending body tag. Using REReplace is the most efficient here as your peeling off what you don't want (i.e. whats not body content) _ From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 10:48 AM To: CF-Talk Subject: Regular Expressions: Extract code between BODY tags All: I have a complete HTML file, beginning with doctype declaration and ending with a closing HTML tag, from which I'd like to programmatically strip away everything but the code between (and not including) the BODY tags. That is, only the code (including tags) between the BODY tags should remain. Can anyone provide the RE to accomplish this? TIA -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
Cool.Again, thanks. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ Michael Dinowitz wrote: The additions are correct. I was a bit hasty in my posting. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
Either the .* or the .+ will work as the original poster said that the body tags would be within a validly formatted HTML document. This brings up a question of the relative merits of the * and + modifiers when doing large matches. I'll have to look in Mastering RegEx if there's any known speed or overhead differences. I doubt it, but :) _ From: Pascal Peters [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 11:25 AM To: CF-Talk Subject: RE: Regular Expressions: Extract code between BODY tags Actually this should be rereplacenocase(string, '.*body[^]*(.+)/body.*', \1) Pascal -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: 14 September 2004 16:54 To: CF-Talk Subject: [Spam?] RE: Regular Expressions: Extract code between BODY tags rereplacenocase(string, 'body[^]*(.+)/body', \1) Your looking for the body tag with anything in it, then everything after that body tag that does not include the ending body tag. Using REReplace is the most efficient here as your peeling off what you don't want (i.e. whats not body content) _ From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 10:48 AM To: CF-Talk Subject: Regular Expressions: Extract code between BODY tags All: I have a complete HTML file, beginning with doctype declaration and ending with a closing HTML tag, from which I'd like to programmatically strip away everything but the code between (and not including) the BODY tags. That is, only the code (including tags) between the BODY tags should remain. Can anyone provide the RE to accomplish this? TIA -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ _ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular Expressions: Extract code between BODY tags
I posted this before the answer from Mosh, but our mail is going out very slowly lately. It was a correction on your post (.* OR .+ was missing before and after your regexp), not on Mosh's second post (that I didn't have at that time). .+ or .* will of course both work and I also doubt there is any difference. Pascal -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: 14 September 2004 17:34 To: CF-Talk Subject: [Spam?] RE: Regular Expressions: Extract code between BODY tags Either the .* or the .+ will work as the original poster said that the body tags would be within a validly formatted HTML document. This brings up a question of the relative merits of the * and + modifiers when doing large matches. I'll have to look in Mastering RegEx if there's any known speed or overhead differences. I doubt it, but :) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Regular expressions
Can someone tell me why the following code will not work: cfset myvar = REReplace(myvar, %([[:xdigit:]]{2}), urlDecode('\1'), ALL) I am trying to write a function that will take the filecontent from a cfhttp request and unescape any hexidecimal sequences it finds (for example %20 for a space. I am trying to use backreferencing with a regular _expression_ to find these sequences and then unescape them using urlDecode. I've already tried passing the entire string into urlDecode but it won't take it. Thanks, Joe [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regular expressions
I am not 100% percent sure, but my mind tells me you can't run a CF function on the backreference value in a regular _expression_. Jerry Johnson [EMAIL PROTECTED] 07/07/04 02:48PM Can someone tell me why the following code will not work: cfset myvar = REReplace(myvar, %([[:xdigit:]]{2}), urlDecode('\1'), ALL) I am trying to write a function that will take the filecontent from a cfhttp request and unescape any hexidecimal sequences it finds (for example %20 for a space. I am trying to use backreferencing with a regular _expression_ to find these sequences and then unescape them using urlDecode. I've already tried passing the entire string into urlDecode but it won't take it. Thanks, Joe [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: Regular expressions
Rereplace takes 4 strings, it doesn't take any expressions.To put it another way, any expressions you place inside the function call are evaluated into strings, and then the strings are passed to the Rereplace call.The only processing you can use inside the replace string is that which the RE engine exposes, you can't use any CF processing.If you want to do that, then you have to manually loop over the string, and perform the given operation manually. Cheers, barneyb -Original Message- From: Joe Bernard [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 11:49 AM To: CF-Talk Subject: Regular expressions Can someone tell me why the following code will not work: cfset myvar = REReplace(myvar, %([[:xdigit:]]{2}), urlDecode('\1'), ALL) I am trying to write a function that will take the filecontent from a cfhttp request and unescape any hexidecimal sequences it finds (for example %20 for a space. I am trying to use backreferencing with a regular _expression_ to find these sequences and then unescape them using urlDecode. I've already tried passing the entire string into urlDecode but it won't take it. Thanks, Joe [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Regular expressions
Thanks for the help. For anyone who is interested, here is the code I came up with to escape the hex sequences. urlDecode wasn't working right so I used a workaround (inputBaseN). cfloop condition=reFind('%([[:xdigit:]]{2})',filecontent) cfset st = reFind(%([[:xdigit:]]{2}),filecontent,1,true) cfset filecontent = replaceNoCase(filecontent,mid(filecontent,st.pos[1],st.len[1]),chr(inputBaseN(mid(filecontent,st.pos[1]+1,st.len[1]-1),16)),ALL) /cfloop [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
More fun with regular expressions
Hey regexp gurus... I'm trying to formulate an _expression_ that checks a string for at least one alpha and at least one numeric character, but -no- non-alphanumeric characters. Getting the alphanumeric combo I seem to have been able to do...but adding the 'no non-alphanumerics' into the _expression_ isn't working out for me. Much appreciation in advance. Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: More fun with regular expressions
The difficulty is at least one of each. I think this should do it ^[[:alnum:]]*([a-z][0-9]|[0-9][a-z])[[:alnum:]]*$ Not tested Pascal -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: dinsdag 29 juni 2004 22:40 To: CF-Talk Subject: More fun with regular expressions Hey regexp gurus... I'm trying to formulate an _expression_ that checks a string for at least one alpha and at least one numeric character, but -no- non-alphanumeric characters. Getting the alphanumeric combo I seem to have been able to do...but adding the 'no non-alphanumerics' into the _expression_ isn't working out for me. Much appreciation in advance. Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: More fun with regular expressions
ReFindNoCase([^A-Z0-9], yourSource) HTH Dick On Jun 29, 2004, at 1:40 PM, Charlie Griefer wrote: Hey regexp gurus... I'm trying to formulate an _expression_ that checks a string for at least one alpha and at least one numeric character, but -no- non-alphanumeric characters. Getting the alphanumeric combo I seem to have been able to do...but adding the 'no non-alphanumerics' into the _expression_ isn't working out for me. Much appreciation in advance. Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: More fun with regular expressions
...but that won't ensure at least one alpha and one numeric... A will pass (should fail) 12345 will pass (should fail) Maybe it should just be two separate regex calls?One to check for an alpha and a number...and another to check for no non-alphanumerics (?) Charlie -Original Message- From: Dick Applebaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 6:11 PM To: CF-Talk Subject: Re: More fun with regular expressions ReFindNoCase([^A-Z0-9], yourSource) HTH Dick On Jun 29, 2004, at 1:40 PM, Charlie Griefer wrote: Hey regexp gurus... I'm trying to formulate an _expression_ that checks a string for at least one alpha and at least one numeric character, but -no- non-alphanumeric characters. Getting the alphanumeric combo I seem to have been able to do...but adding the 'no non-alphanumerics' into the _expression_ isn't working out for me. Much appreciation in advance. Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: More fun with regular expressions
You might be able to do it in one regexp but 2 will be a lot less effort a lot easier to understand 6 months from now. Dick On Jun 29, 2004, at 6:37 PM, Charlie Griefer wrote: ...but that won't ensure at least one alpha and one numeric... A will pass (should fail) 12345 will pass (should fail) Maybe it should just be two separate regex calls? One to check for an alpha and a number...and another to check for no non-alphanumerics (?) Charlie -Original Message- From: Dick Applebaum [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 6:11 PM To: CF-Talk Subject: Re: More fun with regular expressions ReFindNoCase([^A-Z0-9], yourSource) HTH Dick On Jun 29, 2004, at 1:40 PM, Charlie Griefer wrote: Hey regexp gurus... I'm trying to formulate an _expression_ that checks a string for at least one alpha and at least one numeric character, but -no- non-alphanumeric characters. Getting the alphanumeric combo I seem to have been able to do...but adding the 'no non-alphanumerics' into the _expression_ isn't working out for me. Much appreciation in advance. Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: More fun with regular expressions
I repeat: ^[[:alnum:]]*([a-z][0-9]|[0-9][a-z])[[:alnum:]]*$ -Original Message- From: Charlie Griefer [mailto:[EMAIL PROTECTED] Sent: woensdag 30 juni 2004 3:37 To: CF-Talk Subject: RE: More fun with regular expressions ...but that won't ensure at least one alpha and one numeric... A will pass (should fail) 12345 will pass (should fail) Maybe it should just be two separate regex calls?One to check for an alpha and a number...and another to check for no non-alphanumerics (?) Charlie [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
OT: Regular expressions in JS (or in general) for dates
Regex gurus, I have a string and I want to ensure that the date format is: xx/xx/ or x/x/ or x/x/xx (you get the idea) Does anyone have a stock regex for this?Am I going to need more than 1 or can I look at everything (length, format and range of numbers) in 1 regex? -mark Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com http://blog.mxconsulting.com ...what the web can be! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular expressions in JS (or in general) for dates
You can't do it with only regexp. There is a function in the cfide/scripts/cfform.js file tht does about that. You can validate most of it with /^(0?[1-9]|[12]\d|3[01])\/(0?[1-9]|1[0-2])\/(\d{2}){1,2}$/ Then extract the day, month and year and see if the day is correct. -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED] Sent: vrijdag 11 juni 2004 18:41 To: CF-Talk Subject: OT: Regular expressions in JS (or in general) for dates Regex gurus, I have a string and I want to ensure that the date format is: xx/xx/ or x/x/ or x/x/xx (you get the idea) Does anyone have a stock regex for this?Am I going to need more than 1 or can I look at everything (length, format and range of numbers) in 1 regex? -mark Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com http://blog.mxconsulting.com ...what the web can be! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: OT: Regular expressions in JS (or in general) for dates
You could try something like this: \d{1,2}/\d{1,2}/\d\d(?\d\d)? Of course, that's only using slashes, not dashes or dots or spaces, but it should give you the right idea. --BenD Mark A. Kruger - CFG wrote: Regex gurus, I have a string and I want to ensure that the date format is: xx/xx/ or x/x/ or x/x/xx (you get the idea) Does anyone have a stock regex for this?Am I going to need more than 1 or can I look at everything (length, format and range of numbers) in 1 regex? -mark Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com http://blog.mxconsulting.com ...what the web can be! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular expressions in JS (or in general) for dates
function daysInMonth(y,m){ if (m == 4 || m == 6 || m == 9 || m == 11) return 30; else if (m == 2) { if (y % 4 0) return 28; else if (y % 100 == 0 y % 400 0) return 28; else return 29; } else return 31; } function isDate(date){ var date_pattern = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{2}){1,2}$/; if(!date_pattern.test(date)) return false; var aDate = date.split(/); if(aDate[2].length==2) aDate[2] = (eval(aDate[2])30)?19:20 + aDate[2]; alert(aDate[2]+-+aDate[0]+-+aDate[1]); if(eval(aDate[1])daysInMonth(eval(aDate[2]),eval(aDate[0]))) return false; return true; } -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED] Sent: vrijdag 11 juni 2004 18:41 To: CF-Talk Subject: OT: Regular expressions in JS (or in general) for dates Regex gurus, I have a string and I want to ensure that the date format is: xx/xx/ or x/x/ or x/x/xx (you get the idea) Does anyone have a stock regex for this?Am I going to need more than 1 or can I look at everything (length, format and range of numbers) in 1 regex? -mark Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com http://blog.mxconsulting.com ...what the web can be! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Regular expressions in JS (or in general) for dates
Thanks! also thanks to Ben. This is what I needed. -Mark -Original Message- From: Pascal Peters [mailto:[EMAIL PROTECTED] Sent: Friday, June 11, 2004 12:38 PM To: CF-Talk Subject: RE: Regular expressions in JS (or in general) for dates function daysInMonth(y,m){ if (m == 4 || m == 6 || m == 9 || m == 11) return 30; else if (m == 2) { if (y % 4 0) return 28; else if (y % 100 == 0 y % 400 0) return 28; else return 29; } else return 31; } function isDate(date){ var date_pattern = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{2}){1,2}$/; if(!date_pattern.test(date)) return false; var aDate = date.split(/); if(aDate[2].length==2) aDate[2] = (eval(aDate[2])30)?19:20 + aDate[2]; alert(aDate[2]+-+aDate[0]+-+aDate[1]); if(eval(aDate[1])daysInMonth(eval(aDate[2]),eval(aDate[0]))) return false; return true; } -Original Message- From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED] Sent: vrijdag 11 juni 2004 18:41 To: CF-Talk Subject: OT: Regular expressions in JS (or in general) for dates Regex gurus, I have a string and I want to ensure that the date format is: xx/xx/ or x/x/ or x/x/xx (you get the idea) Does anyone have a stock regex for this?Am I going to need more than 1 or can I look at everything (length, format and range of numbers) in 1 regex? -mark Mark A. Kruger, MCSE, CFG www.cfwebtools.com www.necfug.com http://blog.mxconsulting.com ...what the web can be! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
SPOT: Regular Expressions
I need a regular _expression_ to find any charcter that is not a lower case letter.This does not work. reFind([^[a-z]],arguments.userid) This lets anything through: reFind(^[a-z],arguments.userid) I have also tried using ^[[:alpha:]] Any help would be appreciated. Ken Ketsdever Web Developer www.BloodSource.org http://www.bloodsource.org/ (916) 453-3718 A person who is nice to you, but rude to the waiter is not a nice person 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. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: SPOT: Regular Expressions
Maybe this: reFind([^a-z],arguments.userid) Jerry Johnson [EMAIL PROTECTED] 06/09/04 03:52PM I need a regular _expression_ to find any charcter that is not a lower case letter.This does not work. reFind([^[a-z]],arguments.userid) This lets anything through: reFind(^[a-z],arguments.userid) I have also tried using ^[[:alpha:]] Any help would be appreciated. Ken Ketsdever Web Developer www.BloodSource.org http://www.bloodsource.org/ (916) 453-3718 A person who is nice to you, but rude to the waiter is not a nice person 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. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: SPOT: Regular Expressions
REFind([A-Z], Arguments.UserID) Ken Ketsdever wrote: I need a regular _expression_ to find any charcter that is not a lower case letter. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: SPOT: Regular Expressions
Oops, helps if I read the question: REFind(^[a-z], Arguments.UserID) [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: SPOT: Regular Expressions
This might be little more helpful... Jerry Johnson [EMAIL PROTECTED] 06/09/04 03:52PM reFind([^[a-z]],arguments.userid) I don't think this is valid. reFind(^[a-z],arguments.userid) This will search for lowercase as the first letter of the string I have also tried using ^[[:alpha:]] This will search for any alpha character (a-zA-z0-9) as the first letter of the string [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: SPOT: Regular Expressions
reFind([^[a-z]],arguments.userid) [^a-z] You were close.You just need to remove the extra brackets. Putting the carat outside the brackets means beginning of string, btw. --Ben [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
help with regular expressions!
Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: help with regular expressions!
Why regex rather than just Replace() or ListGetAt()? - Original Message - From: cf coder To: CF-Talk Sent: Friday, May 14, 2004 11:15 AM Subject: help with regular expressions! Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: help with regular expressions!
I don't think his string has delimiters. -Original Message- From: Dave Francis [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 10:34 AM To: CF-Talk Subject: Re: help with regular expressions! Why regex rather than just Replace() or ListGetAt()? - Original Message - From: cf coder To: CF-Talk Sent: Friday, May 14, 2004 11:15 AM Subject: help with regular expressions! Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: help with regular expressions!
well I thought we regular expressions I can do some patter matching something to look for the first set of opening and closing 3 stars *** and replace everything inside/between the stars including the stars with span class=timeUser 1 | 14/4/2004 15:58:15/span I don't think his string has delimiters. -Original Message- From: Dave Francis [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 10:34 AM To: CF-Talk Subject: Re: help with regular expressions! Why regex rather than just Replace() or ListGetAt()? - Original Message - From: cf coder To: CF-Talk Sent: Friday, May 14, 2004 11:15 AM Subject: help with regular expressions! Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: help with regular expressions!
every string has delimiters - Original Message - From: [EMAIL PROTECTED] To: CF-Talk Sent: Friday, May 14, 2004 11:39 AM Subject: RE: help with regular expressions! I don't think his string has delimiters. -Original Message- From: Dave Francis [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 10:34 AM To: CF-Talk Subject: Re: help with regular expressions! Why regex rather than just Replace() or ListGetAt()? - Original Message - From: cf coder To: CF-Talk Sent: Friday, May 14, 2004 11:15 AM Subject: help with regular expressions! Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: help with regular expressions!
First a couple of observations: If it were me, all of those fields would be in separate fields in the database. Then there would be no need to do what you are doing. However, it that's not an option, change the way you are posting the data so it's a list, and parse it out that way, using a delimiter like chr(128) or something else as innocuous. Then, pulling it apart is simply a retrieval of a particular list item. So for example, if you used the pipe symbol (|): User1|10/28/2003|2:53:52|THIS IS A TEST Now it's as simple as cfscript un = listGetAt( query.column, 1, |); dt = listGetAt( query.column, 2, |); tm = listGetAt( query.column, 3, |); cm = listGetAt( query.column, 4, |); /cfscript cfoutput span class=time#un# | #dt# #tm#/span #cm# /cfoutput As far as regex, the problem is the username.eg is it always one word, or is it possible to have one with spaces in it?If your example is correct, I would say that a regex solution won't work either. Show us some actual data. Thanks, Robert Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: help with regular expressions!
If you don't need the pipe symbol betwee the username and the date, then the following would do: cfcsript txt = query.column; txt = replace( txt, ***, span); // replace first *** txt = replace( txt, ***, /span); // replace second *** cmStart = val( Find( /span, txt)+7 ); cmEnd = len(txt); dspTxt = mid( txt, 1, cmStart); cm = mid( txt, cmStart, cmEnd - cmStart); /cfscript cfoutput#dsptxt#br #cm# /cfoutput Still, if you could replace your posting script to change it's format that would be the way to do it.Either (ok) MAKE it post the list in the format you need it in, or (BEST) break the data into separate columns in your database. well I thought we regular expressions I can do some patter matching something to look for the first set of opening and closing 3 stars *** and replace everything inside/between the stars including the stars with span class=timeUser 1 | 14/4/2004 15:58:15/span I don't think his string has delimiters. -Original Message- From: Dave Francis [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 10:34 AM To: CF-Talk Subject: Re: help with regular expressions! Why regex rather than just Replace() or ListGetAt()? - Original Message - From: cf coder To: CF-Talk Sent: Friday, May 14, 2004 11:15 AM Subject: help with regular expressions! Hello Everybody, I've tried hard to find a solution to my problem but have had no luck. I am pulling the data from the 'comments' column in a database table. The data in the comments column looks like this. *** User1 10/28/2003 2:53:52 *** THIS IS A TEST *** User 2 04/06/200313:41:47 *** blah, blah I want to read everything that's between the *** ie *** User 1 10/28/2003 2:53:52 *** and display it like this: span class=timeUser 1 | 14/4/2004 15:58:15/span THIS IS A TEST Can somebody please show me how to do this using regular expressions? Many thanks cf coder __ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Regular Expressions in NY
I'm giving a full class on Regular Expressions for CFMX 6.1 tomorrow night at the NYCFUG (www.nycfug.org). We'll try to have the audio of the meeting sent out over Flashcomm and the handouts posted up to the site. If anyone in NY is interested in the topic or just wants to come for a chance at winning some books, please go to the NYCFUG site and sign up. -- Michael Dinowitz Finding technical solutions to the problems you didn't know you had yet [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
OT- Regular Expressions.
Hello All, Are there any Regexp gurus out there I'm trying to build an _expression_ to do the following. Except 3 letters (in which there must be at least 1 I or Z), an optional space and a numerical range 1-(Irish Car registration plates) So far I have got: (([\D\S]{1})|(?=Z[\D\S]{1})|(?=I[\D\S]{1})){3}[\s]?[0-9]{1,4} But that doesn't force the first component to have at least 1 I or Zand it also appears to allow 2 characters. My eyes are starting to cross over!! can anyone help ? Cheers, Darren [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: OT- Regular Expressions.
^([IZ][A-Z]{2}|[A-Z][IZ][A-Z]|[A-Z]{2}[IZ])[ ]?[1-9][0-9]{0,3}$ -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Verzonden: wo 22/10/2003 12:16 Aan: CF-Talk CC: Onderwerp: OT- Regular Expressions. Hello All, Are there any Regexp gurus out there I'm trying to build an _expression_ to do the following. Except 3 letters (in which there must be at least 1 I or Z), an optional space and a numerical range 1-(Irish Car registration plates) So far I have got: (([\D\S]{1})|(?=Z[\D\S]{1})|(?=I[\D\S]{1})){3}[\s]?[0-9]{1,4} But that doesn't force the first component to have at least 1 I or Zand it also appears to allow 2 characters. My eyes are starting to cross over!! can anyone help ? Cheers, Darren _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: OT- Regular Expressions.
Bingo ! Thats the fella. Thanks for your help -Darren -Original Message- From: Pascal Peters [mailto:[EMAIL PROTECTED] Sent: 22 October 2003 12:53 To: CF-Talk Subject: RE: OT- Regular Expressions. ^([IZ][A-Z]{2}|[A-Z][IZ][A-Z]|[A-Z]{2}[IZ])[ ]?[1-9][0-9]{0,3}$ -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Verzonden: wo 22/10/2003 12:16 Aan: CF-Talk CC: Onderwerp: OT- Regular Expressions. Hello All, Are there any Regexp gurus out there I'm trying to build an _expression_ to do the following. Except 3 letters (in which there must be at least 1 I or Z), an optional space and a numerical range 1-(Irish Car registration plates) So far I have got: (([\D\S]{1})|(?=Z[\D\S]{1})|(?=I[\D\S]{1})){3}[\s]?[0-9]{1,4} But that doesn't force the first component to have at least 1 I or Z and it also appears to allow 2 characters. My eyes are starting to cross over!! can anyone help ? Cheers, Darren _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]