[cfaussie] RE: RegEx in DreamWeaver
Title: Message I'd like it to return a href="" so I can then replace a href="" with a href=""index.cfm/page.application")#" Which I figured would be a href"#urlSessionFormat("$1")#" -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve OnnisSent: Thursday, 26 June 2003 5:48 PMTo: CFAussie Mailing ListSubject: [cfaussie] RE: RegEx in DreamWeaver What are you wanting it to return? -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Taco FleurSent: Thursday, June 26, 2003 5:41 PMTo: CFAussie Mailing ListSubject: [cfaussie] RegEx in DreamWeaver I am using a regex to find a string in DreamWeaver and I thought a href=""]" Would return: a href="" but instead it returns: a href="" class="more"More../anbsp;span class="raque"raquo;/span/p/td Is my regex wrong or any otherideas?---You are currently subscribed to cfaussie as: [EMAIL PROTECTED]To unsubscribe send a blank email to [EMAIL PROTECTED]MX Downunder AsiaPac DevCon - http://mxdu.com/ ---You are currently subscribed to cfaussie as: [EMAIL PROTECTED]To unsubscribe send a blank email to [EMAIL PROTECTED]MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
[cfaussie] RE: RegEx in DreamWeaver
Perfect, Thanks that was it... I thought it would halt at the first double quote as I have [^] ??? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lindsay Evans Sent: Thursday, 26 June 2003 6:01 PM To: CFAussie Mailing List Subject: [cfaussie] RE: RegEx in DreamWeaver The RegEx will match the first one, as it is matching any character (except for line breaks, I believe) any number of times. This would probably be a better way to go: a href=([^]*) Which matches any character that *isn't* a double quote any number of times. HTH -- Lindsay Evans. Developer, Red Square Productions. [p] 8596.4000 [f] 8596.4001 [w] www.redsquare.com.au -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Taco Fleur Sent: Thursday, June 26, 2003 5:41 PM To: CFAussie Mailing List Subject: [cfaussie] RegEx in DreamWeaver I am using a regex to find a string in DreamWeaver and I thought a href=(.*)[^] Would return: a href=index.cfm/page.application but instead it returns: a href=index.cfm/page.application class=moreMore../anbsp;span class=raqueraquo;/span/p/td Is my regex wrong or any other ideas? --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
[cfaussie] RE: RegEx in DreamWeaver
yeah, that's a tricky one. What your first RegEx was doing is the equivalent of saying: Match any number of characters (except for newlines), followed by any character that isn't a double quote. The first pattern will (usually) be matched first, then the RegEx engine will start all over again until it finds any character that is a line break (I think there may be more to it than that, something along the lines of '. matches any printable character', but I may be wrong) which is followed by a character that isn't a double quote. (Just finished reading all about the internals of Perl's RegEx engine in _Computer Science And Perl Programming_, bit of a heavy read, but I now know all sorts of useless things about it :) -- Lindsay Evans. Developer, Red Square Productions. [p] 8596.4000 [f] 8596.4001 [w] www.redsquare.com.au -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Taco Fleur Sent: Thursday, June 26, 2003 6:02 PM To: CFAussie Mailing List Subject: [cfaussie] RE: RegEx in DreamWeaver Perfect, Thanks that was it... I thought it would halt at the first double quote as I have [^] ??? snip/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
[cfaussie] RE: RegEx in DreamWeaver
One more for the regex guru's How about excluding the link when there is no content between the double quotes? Would adding {.,0} do the trick? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lindsay Evans Sent: Thursday, 26 June 2003 6:01 PM To: CFAussie Mailing List Subject: [cfaussie] RE: RegEx in DreamWeaver The RegEx will match the first one, as it is matching any character (except for line breaks, I believe) any number of times. This would probably be a better way to go: a href=([^]*) Which matches any character that *isn't* a double quote any number of times. HTH -- Lindsay Evans. Developer, Red Square Productions. [p] 8596.4000 [f] 8596.4001 [w] www.redsquare.com.au -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Taco Fleur Sent: Thursday, June 26, 2003 5:41 PM To: CFAussie Mailing List Subject: [cfaussie] RegEx in DreamWeaver I am using a regex to find a string in DreamWeaver and I thought a href=(.*)[^] Would return: a href=index.cfm/page.application but instead it returns: a href=index.cfm/page.application class=moreMore../anbsp;span class=raqueraquo;/span/p/td Is my regex wrong or any other ideas? --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/
[cfaussie] RE: RegEx in DreamWeaver
a href=([^]*) Try a href=([^]+) * means 0 or more + means 1 or more ? Means 0 or 1 One of the key things to understand about regexs is that they are greedy. That means that they get processed from left to right, and each criteria will claim as much as it can. The net result is that saying .* will match everything, and any criteria that follow it will never get a chance to operate. Often times this is not how you want things to work, you would prefer the opposite to happen. Perl ( and hence cfmx ) has support for a not greedy operator, you just stick ? After the + or * Eg: your orignial regex a href=.*?should now work but you might wanta href=.+? to skip the empty urls Jon. --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/